Struct js::jsapi::ClassExtension
[−]
[src]
#[repr(C)]pub struct ClassExtension { pub weakmapKeyDelegateOp: JSWeakmapKeyDelegateOp, pub objectMovedOp: JSObjectMovedOp, }
Fields
weakmapKeyDelegateOp: JSWeakmapKeyDelegateOp
If an object is used as a key in a weakmap, it may be desirable for the garbage collector to keep that object around longer than it otherwise would. A common case is when the key is a wrapper around an object in another compartment, and we want to avoid collecting the wrapper (and removing the weakmap entry) as long as the wrapped object is alive. In that case, the wrapped object is returned by the wrapper's weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakmap key, it will not be collected (and remain in the weakmap) until the wrapped object is collected.
objectMovedOp: JSObjectMovedOp
Optional hook called when an object is moved by a compacting GC.
There may exist weak pointers to an object that are not traced through when the normal trace APIs are used, for example objects in the wrapper cache. This hook allows these pointers to be updated.
Note that this hook can be called before JS_NewObject() returns if a GC is triggered during construction of the object. This can happen for global objects for example.