xpcom/base/nsIWeakReference.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "nsISupports.idl"
michael@0 8
michael@0 9
michael@0 10 /**
michael@0 11 * An instance of |nsIWeakReference| is a proxy object that cooperates with
michael@0 12 * its referent to give clients a non-owning, non-dangling reference. Clients
michael@0 13 * own the proxy, and should generally manage it with an |nsCOMPtr| (see the
michael@0 14 * type |nsWeakPtr| for a |typedef| name that stands out) as they would any
michael@0 15 * other XPCOM object. The |QueryReferent| member function provides a
michael@0 16 * (hopefully short-lived) owning reference on demand, through which clients
michael@0 17 * can get useful access to the referent, while it still exists.
michael@0 18 *
michael@0 19 * @version 1.0
michael@0 20 * @see nsISupportsWeakReference
michael@0 21 * @see nsWeakReference
michael@0 22 * @see nsWeakPtr
michael@0 23 */
michael@0 24 [scriptable, uuid(9188bc85-f92e-11d2-81ef-0060083a0bcf)]
michael@0 25 interface nsIWeakReference : nsISupports
michael@0 26 {
michael@0 27 /**
michael@0 28 * |QueryReferent| queries the referent, if it exists, and like |QueryInterface|, produces
michael@0 29 * an owning reference to the desired interface. It is designed to look and act exactly
michael@0 30 * like (a proxied) |QueryInterface|. Don't hold on to the produced interface permanently;
michael@0 31 * that would defeat the purpose of using a non-owning |nsIWeakReference| in the first place.
michael@0 32 */
michael@0 33 void QueryReferent( in nsIIDRef uuid, [iid_is(uuid), retval] out nsQIResult result );
michael@0 34 };
michael@0 35
michael@0 36
michael@0 37 /**
michael@0 38 * |nsISupportsWeakReference| is a factory interface which produces appropriate
michael@0 39 * instances of |nsIWeakReference|. Weak references in this scheme can only be
michael@0 40 * produced for objects that implement this interface.
michael@0 41 *
michael@0 42 * @version 1.0
michael@0 43 * @see nsIWeakReference
michael@0 44 * @see nsSupportsWeakReference
michael@0 45 */
michael@0 46 [scriptable, uuid(9188bc86-f92e-11d2-81ef-0060083a0bcf)]
michael@0 47 interface nsISupportsWeakReference : nsISupports
michael@0 48 {
michael@0 49 /**
michael@0 50 * |GetWeakReference| produces an appropriate instance of |nsIWeakReference|.
michael@0 51 * As with all good XPCOM `getters', you own the resulting interface and should
michael@0 52 * manage it with an |nsCOMPtr|.
michael@0 53 *
michael@0 54 * @see nsIWeakReference
michael@0 55 * @see nsWeakPtr
michael@0 56 * @see nsCOMPtr
michael@0 57 */
michael@0 58 nsIWeakReference GetWeakReference();
michael@0 59 };
michael@0 60
michael@0 61
michael@0 62 %{C++
michael@0 63 #ifdef MOZILLA_INTERNAL_API
michael@0 64 #include "nsIWeakReferenceUtils.h"
michael@0 65 #endif
michael@0 66 %}
michael@0 67

mercurial