Bug 1245393 - Measure s{,Default}RootBranch in the Preferences memory reporter. r=froydnj.

This commit is contained in:
Nicholas Nethercote 2016-02-03 17:30:54 +11:00
parent 830a6d5631
commit 9fed28582d
2 changed files with 15 additions and 2 deletions

View File

@ -245,8 +245,12 @@ Preferences::SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeO
n += iter.Data()->mClosures.ShallowSizeOfExcludingThis(aMallocSizeOf);
}
}
// We don't measure sRootBranch and sDefaultRootBranch here because
// DMD indicates they are not significant.
if (sRootBranch) {
n += reinterpret_cast<nsPrefBranch*>(sRootBranch)->SizeOfIncludingThis(aMallocSizeOf);
}
if (sDefaultRootBranch) {
n += reinterpret_cast<nsPrefBranch*>(sDefaultRootBranch)->SizeOfIncludingThis(aMallocSizeOf);
}
n += pref_SizeOfPrivateData(aMallocSizeOf);
return n;
}

View File

@ -687,6 +687,15 @@ void nsPrefBranch::NotifyObserver(const char *newpref, void *data)
NS_ConvertASCIItoUTF16(suffix).get());
}
size_t
nsPrefBranch::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
{
size_t n = aMallocSizeOf(this);
n += mPrefRoot.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
n += mObservers.ShallowSizeOfExcludingThis(aMallocSizeOf);
return n;
}
void nsPrefBranch::freeObserverList(void)
{
// We need to prevent anyone from modifying mObservers while we're iterating