Bug 1335854 - Tone down non-zero refcount message for dynamic atoms. r=froydnj

--HG--
extra : rebase_source : 31bef82b308fc5f7bd4eebbf898820e0b10640c0
This commit is contained in:
Jorg K 2017-02-01 11:47:00 -05:00
Родитель 0ad3cf17fa
Коммит 22cddce9af
1 изменённых файлов: 15 добавлений и 2 удалений

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

@ -376,6 +376,8 @@ DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
GCKind aKind)
{
uint32_t removedCount = 0; // Use a non-atomic temporary for cheaper increments.
nsAutoCString nonZeroRefcountAtoms;
uint32_t nonZeroRefcountAtomsCount = 0;
for (auto i = gAtomTable->Iter(); !i.Done(); i.Next()) {
auto entry = static_cast<AtomTableEntry*>(i.Get());
if (entry->mAtom->IsStaticAtom()) {
@ -393,10 +395,21 @@ DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
// later on in this function.
nsAutoCString name;
atom->ToUTF8String(name);
nsPrintfCString msg("dynamic atom with non-zero refcount %s!", name.get());
NS_ASSERTION(false, msg.get());
if (nonZeroRefcountAtomsCount == 0) {
nonZeroRefcountAtoms = name;
} else if (nonZeroRefcountAtomsCount < 20) {
nonZeroRefcountAtoms += NS_LITERAL_CSTRING(",") + name;
} else if (nonZeroRefcountAtomsCount == 20) {
nonZeroRefcountAtoms += NS_LITERAL_CSTRING(",...");
}
nonZeroRefcountAtomsCount++;
}
}
if (nonZeroRefcountAtomsCount) {
nsPrintfCString msg("%d dynamic atom(s) with non-zero refcount: %s",
nonZeroRefcountAtomsCount, nonZeroRefcountAtoms.get());
NS_ASSERTION(nonZeroRefcountAtomsCount == 0, msg.get());
}
// During the course of this function, the atom table is locked. This means
// that, barring refcounting bugs in consumers, an atom can never go from