NPObject

Summary

NPObject is a structure that holds a pointer to an NPClass and an integer reference count, and possibly also implementation specific (i.e. plugin specific, or browser specific) members.

NPObject is the type used to express objects exposed by either the plugin or by the browser through this API. The browsers are expected to expose their window objects and everything reachable from it through this API.

NPObjects are reference counted objects, so callers need to be careful to properly release acquired references to them. To aid with the reference counting and ownership management in general, the functions NPN_CreateObject(), NPN_RetainObject(), NPN_ReleaseObject(), and NPN_ReleaseVariantValue() are provided as part of this API.

NPObject behavior is implemented using the set of callback functions defined in NPClass.

Syntax

struct NPObject {
  NPClass *_class;
  uint32_t referenceCount;
  /*
   * Additional space may be allocated here by types of NPObjects
   */
};

Fields

_class
A pointer to the NPClass of which the object is a member.
referenceCount
The reference count for the object.
Warning: Do not manipulate the _class and referenceCount fields directly; use the functions below to manipulate the object.

Functions

See also