Interface nsIWeakReferenceType

An instance of |nsIWeakReference| is a proxy object that cooperates with its referent to give clients a non-owning, non-dangling reference. Clients own the proxy, and should generally manage it with an |nsCOMPtr| (see the type |nsWeakPtr| for a |typedef| name that stands out) as they would any other XPCOM object. The |QueryReferent| member function provides a (hopefully short-lived) owning reference on demand, through which clients can get useful access to the referent, while it still exists.

Version

1.0

See

  • nsISupportsWeakReference
  • nsWeakReference
  • nsWeakPtr

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • |QueryReferent| queries the referent, if it exists, and like |QueryInterface|, produces an owning reference to the desired interface. It is designed to look and act exactly like (a proxied) |QueryInterface|. Don't hold on to the produced interface permanently; that would defeat the purpose of using a non-owning |nsIWeakReference| in the first place.

    Parameters

    • uuid: object
    • result: object

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aMallocSizeOf: MallocSizeOf

    Returns number

Generated using TypeDoc