Bug 718634 - Move CanSkip* to nsCycleCollectionParticipant, r=mccr8

--HG--
extra : rebase_source : 7eb8cadf14e2d38d689e74a354d6edee6f7f9d20
This commit is contained in:
Olli Pettay 2012-01-17 18:32:19 +02:00
Родитель 1d0335e9ff
Коммит 708edb326d
2 изменённых файлов: 48 добавлений и 38 удалений

Просмотреть файл

@ -1735,7 +1735,9 @@ GCGraphBuilder::NoteRoot(PRUint32 langID, void *root,
return;
}
AddNode(root, participant, langID);
if (!participant->CanSkipThis(root)) {
AddNode(root, participant, langID);
}
}
NS_IMETHODIMP_(void)

Просмотреть файл

@ -134,6 +134,9 @@ protected:
class NS_NO_VTABLE nsCycleCollectionParticipant
{
public:
nsCycleCollectionParticipant() : mMightSkip(false) {}
nsCycleCollectionParticipant(bool aSkip) : mMightSkip(aSkip) {}
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CYCLECOLLECTIONPARTICIPANT_IID)
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) = 0;
@ -141,43 +144,6 @@ public:
NS_IMETHOD Root(void *p) = 0;
NS_IMETHOD Unlink(void *p) = 0;
NS_IMETHOD Unroot(void *p) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionParticipant,
NS_CYCLECOLLECTIONPARTICIPANT_IID)
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_COM_GLUE
typedef void
(* TraceCallback)(PRUint32 langID, void *p, const char *name, void *closure);
class NS_NO_VTABLE nsScriptObjectTracer : public nsCycleCollectionParticipant
{
public:
NS_IMETHOD_(void) Trace(void *p, TraceCallback cb, void *closure) = 0;
void NS_COM_GLUE TraverseScriptObjects(void *p,
nsCycleCollectionTraversalCallback &cb);
};
class NS_COM_GLUE nsXPCOMCycleCollectionParticipant
: public nsScriptObjectTracer
{
public:
nsXPCOMCycleCollectionParticipant() : mMightSkip(false) {}
nsXPCOMCycleCollectionParticipant(bool aSkip) : mMightSkip(aSkip) {}
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb);
NS_IMETHOD Root(void *p);
NS_IMETHOD Unlink(void *p);
NS_IMETHOD Unroot(void *p);
NS_IMETHOD_(void) Trace(void *p, TraceCallback cb, void *closure);
NS_IMETHOD_(void) UnmarkPurple(nsISupports *p);
bool CheckForRightISupports(nsISupports *s);
// If CanSkip returns true, p is removed from the purple buffer during
// a call to nsCycleCollector_forgetSkippable().
@ -223,6 +189,48 @@ private:
bool mMightSkip;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionParticipant,
NS_CYCLECOLLECTIONPARTICIPANT_IID)
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_COM_GLUE
typedef void
(* TraceCallback)(PRUint32 langID, void *p, const char *name, void *closure);
class NS_NO_VTABLE nsScriptObjectTracer : public nsCycleCollectionParticipant
{
public:
nsScriptObjectTracer() : nsCycleCollectionParticipant(false) {}
nsScriptObjectTracer(bool aSkip) : nsCycleCollectionParticipant(aSkip) {}
NS_IMETHOD_(void) Trace(void *p, TraceCallback cb, void *closure) = 0;
void NS_COM_GLUE TraverseScriptObjects(void *p,
nsCycleCollectionTraversalCallback &cb);
};
class NS_COM_GLUE nsXPCOMCycleCollectionParticipant
: public nsScriptObjectTracer
{
public:
nsXPCOMCycleCollectionParticipant()
: nsScriptObjectTracer(false) {}
nsXPCOMCycleCollectionParticipant(bool aSkip)
: nsScriptObjectTracer(aSkip) {}
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb);
NS_IMETHOD Root(void *p);
NS_IMETHOD Unlink(void *p);
NS_IMETHOD Unroot(void *p);
NS_IMETHOD_(void) Trace(void *p, TraceCallback cb, void *closure);
NS_IMETHOD_(void) UnmarkPurple(nsISupports *p);
bool CheckForRightISupports(nsISupports *s);
};
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN