~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpcom/base/nsIWeakReference.idl

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 
2
 *
 
3
 * The contents of this file are subject to the Mozilla Public
 
4
 * License Version 1.1 (the "License"); you may not use this file
 
5
 * except in compliance with the License. You may obtain a copy of
 
6
 * the License at http://www.mozilla.org/MPL/
 
7
 * 
 
8
 * Software distributed under the License is distributed on an "AS
 
9
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
10
 * implied. See the License for the specific language governing
 
11
 * rights and limitations under the License.
 
12
 * 
 
13
 * The Original Code is the Mozilla browser.
 
14
 * 
 
15
 * The Initial Developer of the Original Code is Netscape
 
16
 * Communications, Inc.  Portions created by Netscape are
 
17
 * Copyright (C) 1999, Mozilla.  All Rights Reserved.
 
18
 * 
 
19
 * Original Author:
 
20
 *   Scott Collins <scc@mozilla.org>
 
21
 * 
 
22
 * Contributor(s):
 
23
 *   Pierre Phaneuf <pp@ludusdesign.com>
 
24
 */
 
25
 
 
26
#include "nsISupports.idl"
 
27
 
 
28
 
 
29
/**
 
30
 * An instance of |nsIWeakReference| is a proxy object that cooperates with
 
31
 * its referent to give clients a non-owning, non-dangling reference.  Clients
 
32
 * own the proxy, and should generally manage it with an |nsCOMPtr| (see the
 
33
 * type |nsWeakPtr| for a |typedef| name that stands out) as they would any
 
34
 * other XPCOM object.  The |QueryReferent| member function provides a
 
35
 * (hopefully short-lived) owning reference on demand, through which clients
 
36
 * can get useful access to the referent, while it still exists.
 
37
 *
 
38
 * @status FROZEN
 
39
 * @version 1.0
 
40
 * @see nsISupportsWeakReference
 
41
 * @see nsWeakReference
 
42
 * @see nsWeakPtr
 
43
 */
 
44
[scriptable, uuid(9188bc85-f92e-11d2-81ef-0060083a0bcf)]
 
45
interface nsIWeakReference : nsISupports
 
46
  {
 
47
    /**
 
48
     * |QueryReferent| queries the referent, if it exists, and like |QueryInterface|, produces
 
49
     * an owning reference to the desired interface.  It is designed to look and act exactly
 
50
     * like (a proxied) |QueryInterface|.  Don't hold on to the produced interface permanently;
 
51
     * that would defeat the purpose of using a non-owning |nsIWeakReference| in the first place.
 
52
     */
 
53
    void QueryReferent( in nsIIDRef uuid, [iid_is(uuid), retval] out nsQIResult result );
 
54
  };
 
55
 
 
56
 
 
57
/**
 
58
 * |nsISupportsWeakReference| is a factory interface which produces appropriate
 
59
 * instances of |nsIWeakReference|.  Weak references in this scheme can only be
 
60
 * produced for objects that implement this interface.
 
61
 *
 
62
 * @status FROZEN
 
63
 * @version 1.0
 
64
 * @see nsIWeakReference
 
65
 * @see nsSupportsWeakReference
 
66
 */
 
67
[scriptable, uuid(9188bc86-f92e-11d2-81ef-0060083a0bcf)]
 
68
interface nsISupportsWeakReference : nsISupports
 
69
  {
 
70
    /**
 
71
     * |GetWeakReference| produces an appropriate instance of |nsIWeakReference|.
 
72
     * As with all good XPCOM `getters', you own the resulting interface and should
 
73
     * manage it with an |nsCOMPtr|.
 
74
     *
 
75
     * @see nsIWeakReference
 
76
     * @see nsWeakPtr
 
77
     * @see nsCOMPtr
 
78
     */
 
79
    nsIWeakReference GetWeakReference();
 
80
  };
 
81
 
 
82
 
 
83
%{C++
 
84
#ifndef MOZILLA_STRICT_API
 
85
#include "nsIWeakReferenceUtils.h" 
 
86
#endif
 
87
%}
 
88