Bug 1359245 - Keep a linked list of CycleCollectedJSContexts in the runtime (r=mccr8)

This patch keeps a list of all the cooperatively scheduled contexts that are
linked to a runtime. In places where we need to iterate over all contexts (for
GC, specifically), it iterates over the list.

MozReview-Commit-ID: 3pKJX78f2l0
This commit is contained in:
Bill McCloskey
2017-04-24 14:15:46 -07:00
parent 77f8dbf00d
commit 8830029ed4
6 changed files with 62 additions and 32 deletions

View File

@@ -69,6 +69,8 @@ CycleCollectedJSContext::~CycleCollectedJSContext()
return;
}
mRuntime->RemoveContext(this);
if (mIsPrimaryContext) {
mRuntime->Shutdown(mJSContext);
}
@@ -112,6 +114,8 @@ CycleCollectedJSContext::~CycleCollectedJSContext()
void
CycleCollectedJSContext::InitializeCommon()
{
mRuntime->AddContext(this);
mOwningThread->SetScriptObserver(this);
// The main thread has a base recursion depth of 0, workers of 1.
mBaseRecursionDepth = RecursionDepth();