Mozilla.com

  1. MDC
  2. Main Page
  3. SpiderMonkey
  4. JSAPI Reference
  5. JSClass.reserveSlots
Table of contents
  1. 1. Syntax
  2. 2. Description
Table of contents
  1. 1. Syntax
  2. 2. Description

The JSClass.reserveSlots callback is called each time a new object is created.

Syntax

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.

Description

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

Files (0)