2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2012-06-15 06:50:24 -07:00
|
|
|
static void
|
|
|
|
NoteChild(void *aScriptThing, const char *name, void *aClosure)
|
2007-10-29 06:45:07 -07:00
|
|
|
{
|
|
|
|
nsCycleCollectionTraversalCallback *cb =
|
|
|
|
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
2011-02-02 07:30:03 -08:00
|
|
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, name);
|
2012-05-03 12:28:10 -07:00
|
|
|
cb->NoteJSChild(aScriptThing);
|
2007-10-29 06:45:07 -07:00
|
|
|
}
|
|
|
|
|
2012-06-15 06:50:24 -07:00
|
|
|
void
|
|
|
|
nsScriptObjectTracer::TraverseScriptObjects(void *p,
|
|
|
|
nsCycleCollectionTraversalCallback &cb)
|
|
|
|
{
|
|
|
|
Trace(p, NoteChild, &cb);
|
|
|
|
}
|
|
|
|
|
2007-08-06 07:34:02 -07:00
|
|
|
nsresult
|
2012-06-15 06:50:24 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::Root(void *p)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
nsISupports *s = static_cast<nsISupports*>(p);
|
2007-05-24 07:10:02 -07:00
|
|
|
NS_ADDREF(s);
|
|
|
|
return NS_OK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2007-08-06 07:34:02 -07:00
|
|
|
nsresult
|
2012-06-15 06:50:24 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::Unlink(void *p)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2007-05-24 07:10:02 -07:00
|
|
|
return NS_OK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2007-08-06 07:34:02 -07:00
|
|
|
nsresult
|
2012-06-15 06:50:24 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::Unroot(void *p)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
nsISupports *s = static_cast<nsISupports*>(p);
|
2007-05-24 07:10:02 -07:00
|
|
|
NS_RELEASE(s);
|
|
|
|
return NS_OK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2007-08-06 07:34:02 -07:00
|
|
|
nsresult
|
2012-06-15 06:50:24 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::Traverse
|
|
|
|
(void *p, nsCycleCollectionTraversalCallback &cb)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-08-06 07:34:02 -07:00
|
|
|
void
|
2012-06-15 06:50:24 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::UnmarkIfPurple(nsISupports *n)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-29 06:45:07 -07:00
|
|
|
NS_IMETHODIMP_(void)
|
2012-06-15 06:50:24 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::Trace(void *p, TraceCallback cb,
|
|
|
|
void *closure)
|
2007-10-29 06:45:07 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2007-05-24 07:10:02 -07:00
|
|
|
nsXPCOMCycleCollectionParticipant::CheckForRightISupports(nsISupports *s)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-11-11 14:52:30 -08:00
|
|
|
nsISupports* foo;
|
2007-03-22 10:30:00 -07:00
|
|
|
s->QueryInterface(NS_GET_IID(nsCycleCollectionISupports),
|
2010-11-11 14:52:30 -08:00
|
|
|
reinterpret_cast<void**>(&foo));
|
2007-03-22 10:30:00 -07:00
|
|
|
return s == foo;
|
|
|
|
}
|