The JSClass.reserveSlots callback is called each time a new object is created.
typedef uint32 (*JSReserveSlotsOp)(JSContext *cx, JSObject *obj);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
The JS context in which the new object is being created. |
obj |
JSObject * |
The new object. |
The optional Class.reserveSlots hook allows a class to make computed per-instance object slots reservations, in addition to or instead of using JSCLASS_HAS_RESERVED_SLOTS(n) in the JSClass.flags initializer to reserve a constant-per-class number of slots. Implementations of this hook should return the number of slots to reserve, not including any reserved by using JSCLASS_HAS_RESERVED_SLOTS(n) in JSClass.flags.
Note: This hook is called with obj locked by the JSObjectOps-specific mutual exclusion mechanism appropriate for obj, so don't nest other operations that might also lock obj.
Page last modified 15:24, 29 Jan 2008 by Jorend