1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-1999
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsIDOMGCParticipant_h_
39 #define nsIDOMGCParticipant_h_
41 #include "nsISupports.h"
43 template<class E
> class nsCOMArray
;
45 // 0e2a5a8d-28fd-4a5c-8bf1-5b0067ff3286
46 #define NS_IDOMGCPARTICIPANT_IID \
47 { 0x0e2a5a8d, 0x28fd, 0x4a5c, \
48 {0x8b, 0xf1, 0x5b, 0x00, 0x67, 0xff, 0x32, 0x86} }
51 * DOM GC Participants are objects that expose information about
52 * reachability in the native object graphs to help prevent script ->
53 * native -> script cyclical reference from causing leaks due to the
54 * creation of garbage collection roots and native/script boundaries.
56 * Some implementations of nsIDOMGCParticipant may be responsible for
57 * enforcing the requirement that callers of
58 * |nsDOMClassInfo::PreserveWrapper| must call
59 * |nsDOMClassInfo::ReleaseWrapper| before the nsIDOMGCParticipant
60 * argument to the former is destroyed.
62 class nsIDOMGCParticipant
: public nsISupports
65 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMGCPARTICIPANT_IID
)
68 * Get a reference node for what is known to be a strongly connected
69 * component of nsIDOMGCParticipants. For example, DOM trees are
70 * strongly connected, so can return the root node to greatly reduce
71 * the number of nodes on which we need to run graph algorithms.
73 * Note that it's acceptable for nodes in a single strongly connected
74 * component to return different values for GetSCCIndex, as long as
75 * those two values claim that they're reachable from each other in
76 * AppendReachableList.
78 virtual nsIDOMGCParticipant
* GetSCCIndex() = 0;
81 * Append the list of nsIDOMGCPartipants reachable from this one via
82 * C++ getters exposed to script that return a different result from
83 * |GetSCCIndex|. The caller is responsible for taking the transitive
84 * closure of |AppendReachableList|.
86 * This will only be called on objects that are returned by GetSCCIndex.
88 * null pointers may be appended; they will be ignored by the caller.
90 virtual void AppendReachableList(nsCOMArray
<nsIDOMGCParticipant
>& aArray
) = 0;
93 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMGCParticipant
, NS_IDOMGCPARTICIPANT_IID
)
95 #endif // !defined(nsIDOMGCParticipant_h_)