Make DEBUG_CC compile again (broken by the fix for bug 458099). r=bent, NPOTB.

This commit is contained in:
Peter Van der Beken 2009-01-14 13:24:10 +01:00
parent e99a0fd85e
commit 1a76d6b1c6
3 changed files with 21 additions and 2 deletions

View File

@ -553,7 +553,7 @@ nsXPConnect::BeginCycleCollection(nsCycleCollectionTraversalCallback &cb)
return NS_ERROR_OUT_OF_MEMORY;
}
GetRuntime()->UnsetContextGlobals();
GetRuntime()->UnrootContextGlobals();
PRBool alreadyCollecting = mCycleCollecting;
mCycleCollecting = PR_TRUE;
@ -600,7 +600,7 @@ nsXPConnect::FinishCycleCollection()
mCycleCollectionContext = nsnull;
mExplainCycleCollectionContext = nsnull;
GetRuntime()->RestoreContextGlobals();
GetRuntime()->RootContextGlobals();
}
#endif

View File

@ -461,6 +461,22 @@ void XPCJSRuntime::UnrootContextGlobals()
}
}
#ifdef DEBUG_CC
void XPCJSRuntime::RootContextGlobals()
{
JSContext *iter = nsnull, *acx;
while((acx = JS_ContextIterator(GetJSRuntime(), &iter)))
{
if(JS_HAS_OPTION(acx, JSOPTION_UNROOTED_GLOBAL))
{
JS_ToggleOptions(acx, JSOPTION_UNROOTED_GLOBAL);
--mUnrootedGlobalCount;
}
}
NS_ASSERTION(mUnrootedGlobalCount == 0, "bad state");
}
#endif
// static
JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
{

View File

@ -728,6 +728,9 @@ public:
nsresult RemoveJSHolder(void* aHolder);
void UnrootContextGlobals();
#ifdef DEBUG_CC
void RootContextGlobals();
#endif
void DebugDump(PRInt16 depth);