Bug 1174594 (part 2) - Use a more sensible type for UNMARK_{ONLY,AND_SWEEP}. r=mrbkap.

This commit is contained in:
Nicholas Nethercote 2015-06-18 15:34:26 -07:00
parent dd2d2c51ba
commit a1e04654bc

View File

@ -111,9 +111,6 @@ bool xpc::ExtraWarningsForSystemJS() { return sExtraWarningsForSystemJS; }
bool xpc::ExtraWarningsForSystemJS() { return false; }
#endif
static void * const UNMARK_ONLY = nullptr;
static void * const UNMARK_AND_SWEEP = (void*)1;
// *Some* NativeSets are referenced from mClassInfo2NativeSetMap.
// *All* NativeSets are referenced from mNativeSetMap.
// So, in mClassInfo2NativeSetMap we just clear references to the unmarked.
@ -811,7 +808,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
// kept separate, we could sweep only the ones belonging to
// compartments being collected. Currently, though, NativeInterfaces
// are shared between compartments. This ought to be fixed.
void* sweepArg = isCompartmentGC ? UNMARK_ONLY : UNMARK_AND_SWEEP;
bool doSweep = !isCompartmentGC;
// We don't want to sweep the JSClasses at shutdown time.
// At this point there may be JSObjects using them that have
@ -822,13 +819,10 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
XPCNativeScriptableShared* shared = entry->key;
if (shared->IsMarked()) {
shared->Unmark();
continue;
} else if (doSweep) {
delete shared;
i.Remove();
}
if (sweepArg == UNMARK_ONLY)
continue;
delete shared;
i.Remove();
}
}
@ -845,13 +839,10 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
XPCNativeSet* set = entry->key_value;
if (set->IsMarked()) {
set->Unmark();
continue;
} else if (doSweep) {
XPCNativeSet::DestroyInstance(set);
i.Remove();
}
if (sweepArg == UNMARK_ONLY)
continue;
XPCNativeSet::DestroyInstance(set);
i.Remove();
}
for (auto i = self->mIID2NativeInterfaceMap->RemovingIter(); !i.Done(); i.Next()) {
@ -859,13 +850,10 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
XPCNativeInterface* iface = entry->value;
if (iface->IsMarked()) {
iface->Unmark();
continue;
} else if (doSweep) {
XPCNativeInterface::DestroyInstance(iface);
i.Remove();
}
if (sweepArg == UNMARK_ONLY)
continue;
XPCNativeInterface::DestroyInstance(iface);
i.Remove();
}
#ifdef DEBUG