Fix for bug 584048 (Clean up cycle collection code) - rename RootAndUnlinkJSObjects to Root. r=bent.

This commit is contained in:
Peter Van der Beken 2010-12-16 16:30:13 +01:00
parent a571493d4a
commit dae975b92f
5 changed files with 12 additions and 37 deletions

View File

@ -538,7 +538,7 @@ nsXPConnect::ToParticipant(void *p)
}
NS_IMETHODIMP
nsXPConnect::RootAndUnlinkJSObjects(void *p)
nsXPConnect::Root(void *p)
{
return NS_OK;
}
@ -864,7 +864,7 @@ nsXPConnect::GetOutstandingRequests(JSContext* cx)
class JSContextParticipant : public nsCycleCollectionParticipant
{
public:
NS_IMETHOD RootAndUnlinkJSObjects(void *n)
NS_IMETHOD Root(void *n)
{
return NS_OK;
}

View File

@ -554,7 +554,7 @@ public:
static JSBool Base64Decode(JSContext *cx, jsval val, jsval *out);
// nsCycleCollectionParticipant
NS_IMETHOD RootAndUnlinkJSObjects(void *p);
NS_IMETHOD Root(void *p);
NS_IMETHOD Unlink(void *p);
NS_IMETHOD Unroot(void *p);
NS_IMETHOD Traverse(void *p,
@ -2454,7 +2454,7 @@ public:
{
NS_DECL_CYCLE_COLLECTION_CLASS_BODY_NO_UNLINK(XPCWrappedNative,
XPCWrappedNative)
NS_IMETHOD RootAndUnlinkJSObjects(void *p) { return NS_OK; }
NS_IMETHOD Root(void *p) { return NS_OK; }
NS_IMETHOD Unlink(void *p);
NS_IMETHOD Unroot(void *p) { return NS_OK; }
};

View File

@ -1897,7 +1897,7 @@ nsCycleCollector::RootWhite()
{
PtrInfo *pinfo = etor.GetNext();
if (pinfo->mColor == white && mWhiteNodes->AppendElement(pinfo)) {
rv = pinfo->mParticipant->RootAndUnlinkJSObjects(pinfo->mPointer);
rv = pinfo->mParticipant->Root(pinfo->mPointer);
if (NS_FAILED(rv)) {
Fault("Failed root call while unlinking", pinfo);
mWhiteNodes->RemoveElementAt(mWhiteNodes->Length() - 1);

View File

@ -54,7 +54,7 @@ nsScriptObjectTracer::TraverseScriptObjects(void *p,
}
nsresult
nsXPCOMCycleCollectionParticipant::RootAndUnlinkJSObjects(void *p)
nsXPCOMCycleCollectionParticipant::Root(void *p)
{
nsISupports *s = static_cast<nsISupports*>(p);
NS_ADDREF(s);

View File

@ -136,7 +136,7 @@ public:
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) = 0;
NS_IMETHOD RootAndUnlinkJSObjects(void *p) = 0;
NS_IMETHOD Root(void *p) = 0;
NS_IMETHOD Unlink(void *p) = 0;
NS_IMETHOD Unroot(void *p) = 0;
};
@ -164,7 +164,7 @@ class NS_COM_GLUE nsXPCOMCycleCollectionParticipant
public:
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb);
NS_IMETHOD RootAndUnlinkJSObjects(void *p);
NS_IMETHOD Root(void *p);
NS_IMETHOD Unlink(void *p);
NS_IMETHOD Unroot(void *p);
@ -243,31 +243,6 @@ public:
#define NS_CYCLE_COLLECTION_UPCAST(obj, clazz) \
NS_CYCLE_COLLECTION_CLASSNAME(clazz)::Upcast(obj)
///////////////////////////////////////////////////////////////////////////////
// Helpers for implementing nsCycleCollectionParticipant::RootAndUnlinkJSObjects
///////////////////////////////////////////////////////////////////////////////
#define NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(_class) \
NS_IMETHODIMP \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::RootAndUnlinkJSObjects(void *p) \
{ \
nsISupports *s = static_cast<nsISupports*>(p); \
NS_ASSERTION(CheckForRightISupports(s), \
"not the nsISupports pointer we expect"); \
nsXPCOMCycleCollectionParticipant::RootAndUnlinkJSObjects(s); \
_class *tmp = Downcast(s);
#define NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN_NATIVE(_class, _root_function) \
NS_IMETHODIMP \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::RootAndUnlinkJSObjects(void *p) \
{ \
_class *tmp = static_cast<_class*>(p); \
tmp->_root_function();
#define NS_IMPL_CYCLE_COLLECTION_ROOT_END \
return NS_OK; \
}
///////////////////////////////////////////////////////////////////////////////
// Helpers for implementing nsCycleCollectionParticipant::Unlink
///////////////////////////////////////////////////////////////////////////////
@ -522,13 +497,13 @@ NS_CYCLE_COLLECTION_PARTICIPANT_INSTANCE
// Cycle collector helper for classes that don't want to unlink anything.
// Note: if this is used a lot it might make sense to have a base class that
// doesn't do anything in RootAndUnlinkJSObjects/Unlink/Unroot.
// doesn't do anything in Root/Unlink/Unroot.
#define NS_DECL_CYCLE_COLLECTION_CLASS_NO_UNLINK(_class) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public nsXPCOMCycleCollectionParticipant \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_BODY_NO_UNLINK(_class, _class) \
NS_IMETHOD RootAndUnlinkJSObjects(void *p) \
NS_IMETHOD Root(void *p) \
{ \
return NS_OK; \
} \
@ -616,7 +591,7 @@ NS_CYCLE_COLLECTION_PARTICIPANT_INSTANCE
#define NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY \
public: \
NS_IMETHOD RootAndUnlinkJSObjects(void *n); \
NS_IMETHOD Root(void *n); \
NS_IMETHOD Unlink(void *n); \
NS_IMETHOD Unroot(void *n); \
NS_IMETHOD Traverse(void *n, \
@ -641,7 +616,7 @@ NS_CYCLE_COLLECTION_PARTICIPANT_INSTANCE
#define NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(_class, _root_function) \
NS_IMETHODIMP \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::RootAndUnlinkJSObjects(void *p) \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Root(void *p) \
{ \
_class *tmp = static_cast<_class*>(p); \
tmp->_root_function(); \