mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 909490, part 2 - Add callback for zone destruction. r=billm
This commit is contained in:
parent
04485adc4e
commit
03c332e10a
@ -908,6 +908,12 @@ JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallback cal
|
||||
rt->destroyCompartmentCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetDestroyZoneCallback(JSRuntime *rt, JSZoneCallback callback)
|
||||
{
|
||||
rt->destroyZoneCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback callback)
|
||||
{
|
||||
|
@ -841,6 +841,9 @@ typedef JSObject *
|
||||
typedef void
|
||||
(* JSDestroyCompartmentCallback)(JSFreeOp *fop, JSCompartment *compartment);
|
||||
|
||||
typedef void
|
||||
(* JSZoneCallback)(JS::Zone *zone);
|
||||
|
||||
typedef void
|
||||
(* JSCompartmentNameCallback)(JSRuntime *rt, JSCompartment *compartment,
|
||||
char *buf, size_t bufsize);
|
||||
@ -1623,6 +1626,9 @@ JS_GetImplementationVersion(void);
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetDestroyZoneCallback(JSRuntime *rt, JSZoneCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback callback);
|
||||
|
||||
|
@ -2614,6 +2614,7 @@ static void
|
||||
SweepZones(FreeOp *fop, bool lastGC)
|
||||
{
|
||||
JSRuntime *rt = fop->runtime();
|
||||
JSZoneCallback callback = rt->destroyZoneCallback;
|
||||
|
||||
/* Skip the atomsCompartment zone. */
|
||||
Zone **read = rt->zones.begin() + 1;
|
||||
@ -2628,6 +2629,8 @@ SweepZones(FreeOp *fop, bool lastGC)
|
||||
if (!zone->hold && zone->wasGCStarted()) {
|
||||
if (zone->allocator.arenas.arenaListsAreEmpty() || lastGC) {
|
||||
zone->allocator.arenas.checkEmptyFreeLists();
|
||||
if (callback)
|
||||
callback(zone);
|
||||
SweepCompartments(fop, zone, false, lastGC);
|
||||
JS_ASSERT(zone->compartments.empty());
|
||||
fop->delete_(zone);
|
||||
|
@ -146,6 +146,7 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||
nativeStackBase(0),
|
||||
cxCallback(nullptr),
|
||||
destroyCompartmentCallback(nullptr),
|
||||
destroyZoneCallback(nullptr),
|
||||
compartmentNameCallback(nullptr),
|
||||
activityCallback(nullptr),
|
||||
activityCallbackArg(nullptr),
|
||||
|
@ -950,6 +950,9 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
/* Compartment destroy callback. */
|
||||
JSDestroyCompartmentCallback destroyCompartmentCallback;
|
||||
|
||||
/* Zone destroy callback. */
|
||||
JSZoneCallback destroyZoneCallback;
|
||||
|
||||
/* Call this to get the name of a compartment. */
|
||||
JSCompartmentNameCallback compartmentNameCallback;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user