зеркало из https://github.com/mozilla/pjs.git
When doing ExplainLiveExpectedGarbage, suspect all nsXPCWrappedJS so that we get more objects in the graph. b=387224 r=graydon a=brendan
This commit is contained in:
Родитель
7057a344e9
Коммит
e1aa5de18c
|
@ -634,6 +634,27 @@ nsXPConnect::PrintAllReferencesTo(void *p)
|
|||
0x7fffffff, nsnull);
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSDHashOperator)
|
||||
SuspectWrappedJS(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
||||
uint32 number, void *arg)
|
||||
{
|
||||
for (nsXPCWrappedJS* wrapper = ((JSObject2WrappedJSMap::Entry*)hdr)->value;
|
||||
wrapper; wrapper = wrapper->GetNextWrapper())
|
||||
if (wrapper->IsValid() && !wrapper->IsSubjectToFinalization())
|
||||
nsCycleCollector_suspectCurrent(
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Upcast(wrapper));
|
||||
return JS_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
nsXPConnect::SuspectExtraPointers()
|
||||
{
|
||||
// FIXME: We should really just call suspectCurrent on all the roots
|
||||
// in the runtime, or even all the objects in the runtime, except we
|
||||
// can't call suspectCurrent on JS objects.
|
||||
GetRuntime(this)->GetWrappedJSMap()->Enumerate(SuspectWrappedJS, nsnull);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -494,6 +494,7 @@ public:
|
|||
virtual nsCycleCollectionParticipant *ToParticipant(void *p);
|
||||
#ifdef DEBUG_CC
|
||||
virtual void PrintAllReferencesTo(void *p);
|
||||
virtual void SuspectExtraPointers();
|
||||
#endif
|
||||
|
||||
JSObjectRefcounts* GetJSObjectRefcounts() {return mObjRefcounts;}
|
||||
|
|
|
@ -829,6 +829,7 @@ struct nsCycleCollectionXPCOMRuntime :
|
|||
|
||||
#ifdef DEBUG_CC
|
||||
virtual void PrintAllReferencesTo(void *p) {}
|
||||
virtual void SuspectExtraPointers() {}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -2253,8 +2254,10 @@ nsCycleCollector::ExplainLiveExpectedGarbage()
|
|||
mBuf.Empty();
|
||||
|
||||
for (PRUint32 i = 0; i <= nsIProgrammingLanguage::MAX; ++i) {
|
||||
if (mRuntimes[i])
|
||||
if (mRuntimes[i]) {
|
||||
mRuntimes[i]->BeginCycleCollection();
|
||||
mRuntimes[i]->SuspectExtraPointers();
|
||||
}
|
||||
}
|
||||
|
||||
mCollectionInProgress = PR_TRUE;
|
||||
|
|
|
@ -55,6 +55,10 @@ struct nsCycleCollectionLanguageRuntime
|
|||
virtual nsCycleCollectionParticipant *ToParticipant(void *p) = 0;
|
||||
#ifdef DEBUG_CC
|
||||
virtual void PrintAllReferencesTo(void *p) = 0;
|
||||
|
||||
// Call suspectCurrent on any extra pointers that will help build a
|
||||
// larger object graph for debugging.
|
||||
virtual void SuspectExtraPointers() = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче