Bug 909490, part 3 - Add callback for zone sweeping. r=jonco

This commit is contained in:
Andrew McCreight 2013-09-25 13:41:25 -07:00
parent d019fda5e2
commit 634fb697f0
5 changed files with 16 additions and 0 deletions

View File

@ -914,6 +914,12 @@ JS_SetDestroyZoneCallback(JSRuntime *rt, JSZoneCallback callback)
rt->destroyZoneCallback = callback;
}
JS_PUBLIC_API(void)
JS_SetSweepZoneCallback(JSRuntime *rt, JSZoneCallback callback)
{
rt->sweepZoneCallback = callback;
}
JS_PUBLIC_API(void)
JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback callback)
{

View File

@ -1629,6 +1629,9 @@ JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallback cal
extern JS_PUBLIC_API(void)
JS_SetDestroyZoneCallback(JSRuntime *rt, JSZoneCallback callback);
extern JS_PUBLIC_API(void)
JS_SetSweepZoneCallback(JSRuntime *rt, JSZoneCallback callback);
extern JS_PUBLIC_API(void)
JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback callback);

View File

@ -3717,6 +3717,9 @@ BeginSweepingZoneGroup(JSRuntime *rt)
if (rt->isAtomsZone(zone))
sweepingAtoms = true;
if (rt->sweepZoneCallback)
rt->sweepZoneCallback(zone);
}
ValidateIncrementalMarking(rt);

View File

@ -147,6 +147,7 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
cxCallback(nullptr),
destroyCompartmentCallback(nullptr),
destroyZoneCallback(nullptr),
sweepZoneCallback(nullptr),
compartmentNameCallback(nullptr),
activityCallback(nullptr),
activityCallbackArg(nullptr),

View File

@ -953,6 +953,9 @@ struct JSRuntime : public JS::shadow::Runtime,
/* Zone destroy callback. */
JSZoneCallback destroyZoneCallback;
/* Zone sweep callback. */
JSZoneCallback sweepZoneCallback;
/* Call this to get the name of a compartment. */
JSCompartmentNameCallback compartmentNameCallback;