Bug 807883: Use the new PL_SizeOfArenaPoolExcludingPool function

in NSPR 4.9.6. Portions of the patch were written by Nicholas
Nethercote <n.nethercote@gmail.com>. r=n.nethercote.
This commit is contained in:
Wan-Teh Chang 2013-02-12 08:54:38 -08:00
parent 9bcf52ffe4
commit 09e29abdc2
5 changed files with 6 additions and 34 deletions

View File

@ -3856,7 +3856,7 @@ MOZ_ARG_WITH_BOOL(system-nspr,
_USE_SYSTEM_NSPR=1 )
if test -n "$_USE_SYSTEM_NSPR"; then
AM_PATH_NSPR(4.9.4, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
AM_PATH_NSPR(4.9.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
fi
if test -n "$MOZ_NATIVE_NSPR"; then

View File

@ -405,15 +405,8 @@ struct nsPresArena::State {
size_t SizeOfIncludingThisFromMalloc(nsMallocSizeOfFun aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);
// The first PLArena is within the PLArenaPool, i.e. within |this|, so we
// don't measure it. Subsequent PLArenas are by themselves and must be
// measured.
const PLArena *arena = mPool.first.next;
while (arena) {
n += aMallocSizeOf(arena);
arena = arena->next;
}
n += PL_SizeOfArenaPoolExcludingPool(&mPool,
aMallocSizeOf);
n += mFreeLists.SizeOfExcludingThis(SizeOfFreeListEntryExcludingThis,
aMallocSizeOf);
return n;

View File

@ -809,14 +809,7 @@ nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t
size_t
pref_SizeOfPrivateData(nsMallocSizeOfFun aMallocSizeOf)
{
size_t n = 0;
// The first PLArena is within the PLArenaPool, so start measuring
// malloc'd data with the second arena.
const PLArena* arena = gPrefNameArena.first.next;
while (arena) {
n += aMallocSizeOf(arena);
arena = arena->next;
}
size_t n = PL_SizeOfArenaPoolExcludingPool(&gPrefNameArena, aMallocSizeOf);
for (struct CallbackNode* node = gCallbacks; node; node = node->next) {
n += aMallocSizeOf(node);
n += aMallocSizeOf(node->domain);

View File

@ -512,14 +512,7 @@ nsCategoryManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
{
size_t n = aMallocSizeOf(this);
// The first PLArena is within the PLArenaPool, i.e. within |this|, so we
// don't measure it. Subsequent PLArenas are by themselves and must be
// measured.
const PLArena *arena = mArena.first.next;
while (arena) {
n += aMallocSizeOf(arena);
arena = arena->next;
}
n += PL_SizeOfArenaPoolExcludingPool(&mArena, aMallocSizeOf);
n += mTable.SizeOfExcludingThis(SizeOfCategoryManagerTableEntryExcludingThis,
aMallocSizeOf);

View File

@ -1680,14 +1680,7 @@ nsComponentManagerImpl::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
n += mKnownStaticModules.SizeOfExcludingThis(aMallocSizeOf);
n += mKnownModules.SizeOfExcludingThis(nullptr, aMallocSizeOf);
// The first PLArena is within the PLArenaPool, i.e. within |this|, so we
// don't measure it. Subsequent PLArenas are by themselves and must be
// measured.
const PLArena *arena = mArena.first.next;
while (arena) {
n += aMallocSizeOf(arena);
arena = arena->next;
}
n += PL_SizeOfArenaPoolExcludingPool(&mArena, aMallocSizeOf);
n += mPendingServices.SizeOfExcludingThis(aMallocSizeOf);