1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
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/
9 : *
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
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * The Mozilla Foundation.
19 : * Portions created by the Initial Developer are Copyright (C) 2006
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
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.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #include "nsCycleCollectionParticipant.h"
39 : #include "nsCOMPtr.h"
40 :
41 : static void
42 654 : NoteChild(PRUint32 aLangID, void *aScriptThing, const char *name,
43 : void *aClosure)
44 : {
45 : nsCycleCollectionTraversalCallback *cb =
46 654 : static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
47 654 : NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, name);
48 654 : cb->NoteScriptChild(aLangID, aScriptThing);
49 654 : }
50 :
51 : void
52 141032 : nsScriptObjectTracer::TraverseScriptObjects(void *p,
53 : nsCycleCollectionTraversalCallback &cb)
54 : {
55 141032 : Trace(p, NoteChild, &cb);
56 141032 : }
57 :
58 : nsresult
59 133921 : nsXPCOMCycleCollectionParticipant::Root(void *p)
60 : {
61 133921 : nsISupports *s = static_cast<nsISupports*>(p);
62 133921 : NS_ADDREF(s);
63 133921 : return NS_OK;
64 : }
65 :
66 : nsresult
67 0 : nsXPCOMCycleCollectionParticipant::Unlink(void *p)
68 : {
69 0 : return NS_OK;
70 : }
71 :
72 : nsresult
73 133921 : nsXPCOMCycleCollectionParticipant::Unroot(void *p)
74 : {
75 133921 : nsISupports *s = static_cast<nsISupports*>(p);
76 133921 : NS_RELEASE(s);
77 133921 : return NS_OK;
78 : }
79 :
80 : nsresult
81 0 : nsXPCOMCycleCollectionParticipant::Traverse
82 : (void *p, nsCycleCollectionTraversalCallback &cb)
83 : {
84 0 : return NS_OK;
85 : }
86 :
87 : void
88 0 : nsXPCOMCycleCollectionParticipant::UnmarkIfPurple(nsISupports *n)
89 : {
90 0 : }
91 :
92 : NS_IMETHODIMP_(void)
93 0 : nsXPCOMCycleCollectionParticipant::Trace(void *p, TraceCallback cb,
94 : void *closure)
95 : {
96 0 : }
97 :
98 : bool
99 1109498 : nsXPCOMCycleCollectionParticipant::CheckForRightISupports(nsISupports *s)
100 : {
101 : nsISupports* foo;
102 : s->QueryInterface(NS_GET_IID(nsCycleCollectionISupports),
103 1109498 : reinterpret_cast<void**>(&foo));
104 1109498 : return s == foo;
105 : }
|