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

@@ -562,6 +562,18 @@ CycleCollectedJSRuntime::~CycleCollectedJSRuntime()
MOZ_ASSERT(!mDeferredFinalizerTable.Count());
}
void
CycleCollectedJSRuntime::AddContext(CycleCollectedJSContext* aContext)
{
mContexts.insertBack(aContext);
}
void
CycleCollectedJSRuntime::RemoveContext(CycleCollectedJSContext* aContext)
{
aContext->removeFrom(mContexts);
}
size_t
CycleCollectedJSRuntime::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{