зеркало из https://github.com/mozilla/pjs.git
Print more information about nsXPCWrappedJS objects in GC_MARK_DEBUG. b=231384 r=brendan sr=bryner
This commit is contained in:
Родитель
8367be5bbe
Коммит
28185204c6
|
@ -78,6 +78,7 @@
|
||||||
#include "jsinterp.h"
|
#include "jsinterp.h"
|
||||||
#include "jscntxt.h"
|
#include "jscntxt.h"
|
||||||
#include "jsdbgapi.h"
|
#include "jsdbgapi.h"
|
||||||
|
#include "jsgc.h"
|
||||||
#include "xptinfo.h"
|
#include "xptinfo.h"
|
||||||
#include "xpcforwards.h"
|
#include "xpcforwards.h"
|
||||||
#include "xpclog.h"
|
#include "xpclog.h"
|
||||||
|
@ -2172,6 +2173,9 @@ private:
|
||||||
nsXPCWrappedJS* mRoot;
|
nsXPCWrappedJS* mRoot;
|
||||||
nsXPCWrappedJS* mNext;
|
nsXPCWrappedJS* mNext;
|
||||||
nsISupports* mOuter; // only set in root
|
nsISupports* mOuter; // only set in root
|
||||||
|
#ifdef GC_MARK_DEBUG
|
||||||
|
char *mGCRootName;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
|
@ -127,8 +127,16 @@ nsXPCWrappedJS::AddRef(void)
|
||||||
if(2 == cnt && IsValid())
|
if(2 == cnt && IsValid())
|
||||||
{
|
{
|
||||||
XPCCallContext ccx(NATIVE_CALLER);
|
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");
|
JS_AddNamedRoot(ccx.GetJSContext(), &mJSObj, "nsXPCWrappedJS::mJSObj");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cnt;
|
return cnt;
|
||||||
|
@ -159,8 +167,13 @@ do_decrement:
|
||||||
if(IsValid())
|
if(IsValid())
|
||||||
{
|
{
|
||||||
XPCJSRuntime* rt = mClass->GetRuntime();
|
XPCJSRuntime* rt = mClass->GetRuntime();
|
||||||
if(rt)
|
if(rt) {
|
||||||
JS_RemoveRootRT(rt->GetJSRuntime(), &mJSObj);
|
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
|
// 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),
|
mRoot(root ? root : this),
|
||||||
mNext(nsnull),
|
mNext(nsnull),
|
||||||
mOuter(root ? nsnull : aOuter)
|
mOuter(root ? nsnull : aOuter)
|
||||||
|
#ifdef GC_MARK_DEBUG
|
||||||
|
, mGCRootName(nsnull)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_stats_jband
|
#ifdef DEBUG_stats_jband
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче