Bug 1229458 - Remove SizeOfIncludingThisMustBeUnshared() from string classes. r=mccr8.

The patch changes all uses of SizeOfIncludingThisMustBeUnshared() to
SizeOfIncludingThisIfUnshared(). This incurs the (tiny) cost of an unnecessary
IsReadonly() check for guaranteed-unshared strings, but avoids the possible
assertion failures that would occur when MustBeUnshared() was used incorrectly
on shared strings, which is an easy mistake to make.
This commit is contained in:
Nicholas Nethercote
2015-12-01 15:36:26 -08:00
parent d837453d60
commit 262f17feb6
10 changed files with 12 additions and 59 deletions

View File

@@ -1846,7 +1846,7 @@ nsComponentManagerImpl::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
for (auto iter = mContractIDs.ConstIter(); !iter.Done(); iter.Next()) {
// We don't measure the nsFactoryEntry data because it's owned by
// mFactories (which is measured above).
n += iter.Key().SizeOfExcludingThisMustBeUnshared(aMallocSizeOf);
n += iter.Key().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
n += sStaticModules->ShallowSizeOfIncludingThis(aMallocSizeOf);