mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1182318 - Part 2: Remove Closure from CycleCollectedJSRuntime. r=smaug
Closure is now just a wrapper around a single boolean, so instead pass a pointer to the boolean.
This commit is contained in:
parent
ee6ab85145
commit
807cd2fbe2
@ -266,28 +266,18 @@ struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer
|
||||
bool mAnyMarked;
|
||||
};
|
||||
|
||||
struct Closure
|
||||
{
|
||||
explicit Closure()
|
||||
: mCycleCollectionEnabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
bool mCycleCollectionEnabled;
|
||||
};
|
||||
|
||||
static void
|
||||
CheckParticipatesInCycleCollection(JS::GCCellPtr aThing, const char* aName,
|
||||
void* aClosure)
|
||||
{
|
||||
Closure* closure = static_cast<Closure*>(aClosure);
|
||||
bool* cycleCollectionEnabled = static_cast<bool*>(aClosure);
|
||||
|
||||
if (closure->mCycleCollectionEnabled) {
|
||||
if (*cycleCollectionEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (AddToCCKind(aThing.kind()) && JS::GCThingIsMarkedGray(aThing)) {
|
||||
closure->mCycleCollectionEnabled = true;
|
||||
*cycleCollectionEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,20 +647,17 @@ CycleCollectedJSRuntime::TraverseNativeRoots(nsCycleCollectionNoteRootCallback&
|
||||
// would hurt to do this after the JS holders.
|
||||
TraverseAdditionalNativeRoots(aCb);
|
||||
|
||||
Closure closure;
|
||||
for (auto iter = mJSHolders.Iter(); !iter.Done(); iter.Next()) {
|
||||
void* holder = iter.GetKey();
|
||||
nsScriptObjectTracer*& tracer = iter.GetData();
|
||||
|
||||
bool noteRoot;
|
||||
bool noteRoot = false;
|
||||
if (MOZ_UNLIKELY(aCb.WantAllTraces())) {
|
||||
noteRoot = true;
|
||||
} else {
|
||||
closure.mCycleCollectionEnabled = false;
|
||||
tracer->Trace(holder,
|
||||
TraceCallbackFunc(CheckParticipatesInCycleCollection),
|
||||
&closure);
|
||||
noteRoot = closure.mCycleCollectionEnabled;
|
||||
¬eRoot);
|
||||
}
|
||||
|
||||
if (noteRoot) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user