mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Print more information about nsXPCWrappedJS objects in GC_MARK_DEBUG. b=231384 r=brendan sr=bryner
This commit is contained in:
parent
240541d85f
commit
0511192cec
@ -78,6 +78,7 @@
|
||||
#include "jsinterp.h"
|
||||
#include "jscntxt.h"
|
||||
#include "jsdbgapi.h"
|
||||
#include "jsgc.h"
|
||||
#include "xptinfo.h"
|
||||
#include "xpcforwards.h"
|
||||
#include "xpclog.h"
|
||||
@ -2172,6 +2173,9 @@ private:
|
||||
nsXPCWrappedJS* mRoot;
|
||||
nsXPCWrappedJS* mNext;
|
||||
nsISupports* mOuter; // only set in root
|
||||
#ifdef GC_MARK_DEBUG
|
||||
char *mGCRootName;
|
||||
#endif
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -127,8 +127,16 @@ nsXPCWrappedJS::AddRef(void)
|
||||
if(2 == cnt && IsValid())
|
||||
{
|
||||
XPCCallContext ccx(NATIVE_CALLER);
|
||||
if(ccx.IsValid())
|
||||
if(ccx.IsValid()) {
|
||||
#ifdef GC_MARK_DEBUG
|
||||
mGCRootName = JS_smprintf("nsXPCWrappedJS::mJSObj[%s,0x%p,0x%p]",
|
||||
GetClass()->GetInterfaceName(),
|
||||
this, mJSObj);
|
||||
JS_AddNamedRoot(ccx.GetJSContext(), &mJSObj, mGCRootName);
|
||||
#else
|
||||
JS_AddNamedRoot(ccx.GetJSContext(), &mJSObj, "nsXPCWrappedJS::mJSObj");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
@ -159,8 +167,13 @@ do_decrement:
|
||||
if(IsValid())
|
||||
{
|
||||
XPCJSRuntime* rt = mClass->GetRuntime();
|
||||
if(rt)
|
||||
if(rt) {
|
||||
JS_RemoveRootRT(rt->GetJSRuntime(), &mJSObj);
|
||||
#ifdef GC_MARK_DEBUG
|
||||
JS_smprintf_free(mGCRootName);
|
||||
mGCRootName = nsnull;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// If we are not the root wrapper or if we are not being used from a
|
||||
@ -309,6 +322,9 @@ nsXPCWrappedJS::nsXPCWrappedJS(XPCCallContext& ccx,
|
||||
mRoot(root ? root : this),
|
||||
mNext(nsnull),
|
||||
mOuter(root ? nsnull : aOuter)
|
||||
#ifdef GC_MARK_DEBUG
|
||||
, mGCRootName(nsnull)
|
||||
#endif
|
||||
{
|
||||
#ifdef DEBUG_stats_jband
|
||||
static int count = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user