Bug 737365 - stop using the cx during finalization, part 1.
This part changes the signatures for various finalization API to take not JSContext* but rather either JSFreeOp structure or its library-private counterpart FreeOp. These structures wrap parameters that are passed to the finalizers removing most of explicit dependencies on JSContext in the finalization code.
This commit is contained in:
@@ -335,16 +335,16 @@ WeakMap_mark(JSTracer *trc, JSObject *obj)
|
||||
}
|
||||
|
||||
static void
|
||||
WeakMap_finalize(JSContext *cx, JSObject *obj)
|
||||
WeakMap_finalize(FreeOp *fop, JSObject *obj)
|
||||
{
|
||||
if (ObjectValueMap *map = GetObjectMap(obj)) {
|
||||
map->check();
|
||||
#ifdef DEBUG
|
||||
map->~ObjectValueMap();
|
||||
memset(static_cast<void *>(map), 0xdc, sizeof(*map));
|
||||
cx->free_(map);
|
||||
fop->free_(map);
|
||||
#else
|
||||
cx->delete_(map);
|
||||
fop->delete_(map);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user