Bug 1271848, part 1 - Add ClassName() method to the CC participant. r=smaug

This will let us report better information about participants at runtime.
This commit is contained in:
Andrew McCreight 2016-05-12 10:54:33 -07:00
Родитель e32d7653b2
Коммит 1dc278fe13
3 изменённых файлов: 18 добавлений и 4 удалений

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

@ -59,6 +59,8 @@ public:
NS_IMETHOD Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
override;
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(JSGCThingParticipant)
};
class JSZoneParticipant : public nsCycleCollectionParticipant
@ -90,6 +92,8 @@ public:
NS_IMETHOD Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
override;
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(JSZoneParticipant)
};
class IncrementalFinalizeRunnable;

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

@ -78,9 +78,11 @@ class NS_CYCLE_COLLECTION_INNERCLASS \
: public nsXPCOMCycleCollectionParticipant \
{ \
public: \
NS_IMETHOD_(void) Unlink(void *p); \
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb); \
NS_IMETHOD_(void) DeleteCycleCollectable(void* p) \
NS_IMETHOD_(void) Unlink(void *p) override; \
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) \
override; \
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(_class) \
NS_IMETHOD_(void) DeleteCycleCollectable(void* p) override \
{ \
NS_CYCLE_COLLECTION_CLASSNAME(_class):: \
Downcast(static_cast<nsISupports*>(p))->DeleteCycleCollectable(); \

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

@ -121,6 +121,7 @@ public:
NS_IMETHOD_(void) Root(void* aPtr) = 0;
NS_IMETHOD_(void) Unlink(void* aPtr) = 0;
NS_IMETHOD_(void) Unroot(void* aPtr) = 0;
NS_IMETHOD_(const char*) ClassName() = 0;
NS_IMETHOD_(void) Trace(void* aPtr, const TraceCallbacks& aCb,
void* aClosure) {}
@ -506,10 +507,15 @@ DowncastCCParticipant(void* aPtr)
#define NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)
#endif
#define NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(_class) \
NS_IMETHOD_(const char*) ClassName() override { return #_class; };
#define NS_DECL_CYCLE_COLLECTION_CLASS_BODY_NO_UNLINK(_class, _base) \
public: \
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) \
override; \
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(_class) \
NS_IMETHOD_(void) DeleteCycleCollectable(void *p) override \
{ \
DowncastCCParticipant<_class>(p)->DeleteCycleCollectable(); \
@ -644,6 +650,7 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
public: \
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) \
override; \
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(_class) \
static _class* Downcast(nsISupports* s) \
{ \
return static_cast<_class*>(static_cast<_base_class*>( \
@ -699,6 +706,7 @@ static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
NS_IMETHOD_(void) Unroot(void *n) override; \
NS_IMETHOD Traverse(void *n, nsCycleCollectionTraversalCallback &cb) \
override; \
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(_class) \
NS_IMETHOD_(void) DeleteCycleCollectable(void *n) override \
{ \
DowncastCCParticipant<_class>(n)->DeleteCycleCollectable(); \