зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1277260, part 2 - Add and use method to annotate CC crashes with a class name. r=rweiss+418169,smaug
MozReview-Commit-ID: JweRzAC89NS --HG-- extra : rebase_source : 6290588e1a4d1c8f59bd13bd975aa7c4f13903df
This commit is contained in:
Родитель
48ee4c9a3f
Коммит
e9940ac956
|
@ -657,8 +657,29 @@ public:
|
||||||
CC_GRAPH_ASSERT(aLastChild.Initialized());
|
CC_GRAPH_ASSERT(aLastChild.Initialized());
|
||||||
(this + 1)->mFirstChild = aLastChild;
|
(this + 1)->mFirstChild = aLastChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnnotatedReleaseAssert(bool aCondition, const char* aMessage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
PtrInfo::AnnotatedReleaseAssert(bool aCondition, const char* aMessage)
|
||||||
|
{
|
||||||
|
if (aCondition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_CRASHREPORTER
|
||||||
|
const char* piName = "Unknown";
|
||||||
|
if (mParticipant) {
|
||||||
|
piName = mParticipant->ClassName();
|
||||||
|
}
|
||||||
|
nsPrintfCString msg("%s, for class %s", aMessage, piName);
|
||||||
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MOZ_CRASH();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A structure designed to be used like a linked list of PtrInfo, except
|
* A structure designed to be used like a linked list of PtrInfo, except
|
||||||
* it allocates many PtrInfos at a time.
|
* it allocates many PtrInfos at a time.
|
||||||
|
@ -2372,8 +2393,10 @@ CCGraphBuilder::NoteNativeRoot(void* aRoot,
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
CCGraphBuilder::DescribeRefCountedNode(nsrefcnt aRefCount, const char* aObjName)
|
CCGraphBuilder::DescribeRefCountedNode(nsrefcnt aRefCount, const char* aObjName)
|
||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(aRefCount != 0, "CCed refcounted object has zero refcount");
|
mCurrPi->AnnotatedReleaseAssert(aRefCount != 0,
|
||||||
MOZ_RELEASE_ASSERT(aRefCount != UINT32_MAX, "CCed refcounted object has overflowing refcount");
|
"CCed refcounted object has zero refcount");
|
||||||
|
mCurrPi->AnnotatedReleaseAssert(aRefCount != UINT32_MAX,
|
||||||
|
"CCed refcounted object has overflowing refcount");
|
||||||
|
|
||||||
mResults.mVisitedRefCounted++;
|
mResults.mVisitedRefCounted++;
|
||||||
|
|
||||||
|
@ -3204,17 +3227,8 @@ nsCycleCollector::ScanWhiteNodes(bool aFullySynchGraphBuild)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pi->mInternalRefs > pi->mRefCount) {
|
pi->AnnotatedReleaseAssert(pi->mInternalRefs <= pi->mRefCount,
|
||||||
#ifdef MOZ_CRASHREPORTER
|
"More references to an object than its refcount");
|
||||||
const char* piName = "Unknown";
|
|
||||||
if (pi->mParticipant) {
|
|
||||||
piName = pi->mParticipant->ClassName();
|
|
||||||
}
|
|
||||||
nsPrintfCString msg("More references to an object than its refcount, for class %s", piName);
|
|
||||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
|
|
||||||
#endif
|
|
||||||
MOZ_CRASH();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This node will get marked black in the next pass.
|
// This node will get marked black in the next pass.
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче