Bug 867974 - fail more gently when purple buffer count isn't zero. r=smaug

This commit is contained in:
Andrew McCreight 2013-05-09 13:19:00 -07:00
Родитель 04265dd519
Коммит 1f8daed795
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -778,8 +778,8 @@ public:
nsCycleCollectionParticipant *cp = aEntry->mParticipant;
CanonicalizeParticipant(&obj, &cp);
cp->UnmarkIfPurple(obj);
--aBuffer.mCount;
}
--aBuffer.mCount;
}
};
@ -910,7 +910,7 @@ nsPurpleBuffer::SelectPointers(GCGraphBuilder &aBuilder)
SelectPointersVisitor visitor(aBuilder);
VisitEntries(visitor);
MOZ_ASSERT(mCount == 0, "AddPurpleRoot failed");
NS_ASSERTION(mCount == 0, "AddPurpleRoot failed");
if (mCount == 0) {
FreeBlocks();
InitBlocks();
@ -1872,14 +1872,17 @@ PtrInfo*
GCGraphBuilder::AddNode(void *s, nsCycleCollectionParticipant *aParticipant)
{
PtrToNodeEntry *e = static_cast<PtrToNodeEntry*>(PL_DHashTableOperate(&mPtrToNodeMap, s, PL_DHASH_ADD));
if (!e)
if (!e) {
NS_WARNING("Hash table add in GCGraphBuilder::AddNode failed");
return nullptr;
}
PtrInfo *result;
if (!e->mNode) {
// New entry.
result = mNodeBuilder.Add(s, aParticipant);
e->mNode = result;
NS_ASSERTION(result, "mNodeBuilder.Add returned null");
} else {
result = e->mNode;
MOZ_ASSERT(result->mParticipant == aParticipant,
@ -2066,6 +2069,7 @@ AddPurpleRoot(GCGraphBuilder &builder, void *root, nsCycleCollectionParticipant
if (builder.WantAllTraces() || !cp->CanSkipInCC(root)) {
PtrInfo *pinfo = builder.AddNode(root, cp);
if (!pinfo) {
NS_WARNING("builder.AddNode returned null");
return false;
}
}