2007-01-05 01:31:26 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04: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-01-05 01:31:26 +03:00
|
|
|
|
2007-02-18 17:38:04 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2007-01-05 01:31:26 +03:00
|
|
|
|
2012-06-04 10:30:26 +04:00
|
|
|
void
|
|
|
|
nsScriptObjectTracer::NoteJSChild(void *aScriptThing, const char *name,
|
|
|
|
void *aClosure)
|
2007-10-29 16:45:07 +03:00
|
|
|
{
|
|
|
|
nsCycleCollectionTraversalCallback *cb =
|
|
|
|
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
2011-02-02 18:30:03 +03:00
|
|
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, name);
|
2012-05-03 23:28:10 +04:00
|
|
|
cb->NoteJSChild(aScriptThing);
|
2007-10-29 16:45:07 +03:00
|
|
|
}
|
|
|
|
|
2007-08-06 18:34:02 +04:00
|
|
|
nsresult
|
2012-06-04 10:30:26 +04:00
|
|
|
nsXPCOMCycleCollectionParticipant::RootImpl(void *p)
|
2007-01-05 01:31:26 +03:00
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
nsISupports *s = static_cast<nsISupports*>(p);
|
2007-05-24 18:10:02 +04:00
|
|
|
NS_ADDREF(s);
|
|
|
|
return NS_OK;
|
2007-01-05 01:31:26 +03:00
|
|
|
}
|
|
|
|
|
2007-08-06 18:34:02 +04:00
|
|
|
nsresult
|
2012-06-04 10:30:26 +04:00
|
|
|
nsXPCOMCycleCollectionParticipant::UnrootImpl(void *p)
|
2007-03-08 14:31:14 +03:00
|
|
|
{
|
2007-07-08 11:08:04 +04:00
|
|
|
nsISupports *s = static_cast<nsISupports*>(p);
|
2007-05-24 18:10:02 +04:00
|
|
|
NS_RELEASE(s);
|
|
|
|
return NS_OK;
|
2007-03-08 14:31:14 +03:00
|
|
|
}
|
|
|
|
|
2012-08-24 20:50:06 +04:00
|
|
|
// We define a default trace function because some participants don't need
|
|
|
|
// to trace anything, so it is okay for them not to define one.
|
2007-10-29 16:45:07 +03:00
|
|
|
NS_IMETHODIMP_(void)
|
2012-06-04 10:30:26 +04:00
|
|
|
nsXPCOMCycleCollectionParticipant::TraceImpl(void *p, TraceCallback cb,
|
|
|
|
void *closure)
|
2007-10-29 16:45:07 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2007-05-24 18:10:02 +04:00
|
|
|
nsXPCOMCycleCollectionParticipant::CheckForRightISupports(nsISupports *s)
|
2007-02-18 17:38:04 +03:00
|
|
|
{
|
2010-11-12 01:52:30 +03:00
|
|
|
nsISupports* foo;
|
2007-02-18 17:38:04 +03:00
|
|
|
s->QueryInterface(NS_GET_IID(nsCycleCollectionISupports),
|
2010-11-12 01:52:30 +03:00
|
|
|
reinterpret_cast<void**>(&foo));
|
2007-02-18 17:38:04 +03:00
|
|
|
return s == foo;
|
|
|
|
}
|