mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1046281 - Use the simpler version of nsTHashtable memory reporters. r=njn
This commit is contained in:
parent
0a20f9f9da
commit
edbfabc8f6
@ -665,13 +665,10 @@ nsIdentifierMapEntry::HasIdElementExposedAsHTMLDocumentProperty()
|
||||
nsGenericHTMLElement::ShouldExposeIdAsHTMLDocumentProperty(idElement);
|
||||
}
|
||||
|
||||
// static
|
||||
size_t
|
||||
nsIdentifierMapEntry::SizeOfExcludingThis(nsIdentifierMapEntry* aEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void*)
|
||||
nsIdentifierMapEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
return nsStringHashKey::SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
// Helper structs for the content->subdoc map
|
||||
@ -12032,8 +12029,7 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
mStyledLinks.SizeOfExcludingThis(nullptr, aWindowSizes->mMallocSizeOf);
|
||||
|
||||
aWindowSizes->mDOMOtherSize +=
|
||||
mIdentifierMap.SizeOfExcludingThis(nsIdentifierMapEntry::SizeOfExcludingThis,
|
||||
aWindowSizes->mMallocSizeOf);
|
||||
mIdentifierMap.SizeOfExcludingThis(aWindowSizes->mMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
// is worthwhile:
|
||||
|
@ -225,9 +225,7 @@ public:
|
||||
ChangeCallback mKey;
|
||||
};
|
||||
|
||||
static size_t SizeOfExcludingThis(nsIdentifierMapEntry* aEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf,
|
||||
void* aArg);
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
void FireChangeCallbacks(Element* aOldElement, Element* aNewElement,
|
||||
|
@ -1086,18 +1086,15 @@ gfxFontEntry::GetColorLayersInfo(uint32_t aGlyphId,
|
||||
aLayerColors);
|
||||
}
|
||||
|
||||
/* static */ size_t
|
||||
gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis
|
||||
(FontTableHashEntry *aEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void* aUserArg)
|
||||
size_t
|
||||
gfxFontEntry::FontTableHashEntry::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = 0;
|
||||
if (aEntry->mBlob) {
|
||||
n += aMallocSizeOf(aEntry->mBlob);
|
||||
if (mBlob) {
|
||||
n += aMallocSizeOf(mBlob);
|
||||
}
|
||||
if (aEntry->mSharedBlobData) {
|
||||
n += aEntry->mSharedBlobData->SizeOfIncludingThis(aMallocSizeOf);
|
||||
if (mSharedBlobData) {
|
||||
n += mSharedBlobData->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@ -1115,9 +1112,7 @@ gfxFontEntry::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
|
||||
}
|
||||
if (mFontTableCache) {
|
||||
aSizes->mFontTableCacheSize +=
|
||||
mFontTableCache->SizeOfIncludingThis(
|
||||
FontTableHashEntry::SizeOfEntryExcludingThis,
|
||||
aMallocSizeOf);
|
||||
mFontTableCache->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4612,14 +4607,6 @@ gfxFont::SynthesizeSpaceWidth(uint32_t aCh)
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ size_t
|
||||
gfxFont::WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void* aUserArg)
|
||||
{
|
||||
return aMallocSizeOf(aHashEntry->mShapedWord.get());
|
||||
}
|
||||
|
||||
void
|
||||
gfxFont::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
|
||||
FontCacheSizes* aSizes) const
|
||||
@ -4629,9 +4616,7 @@ gfxFont::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
|
||||
mGlyphExtentsArray[i]->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
if (mWordCache) {
|
||||
aSizes->mShapedWords +=
|
||||
mWordCache->SizeOfIncludingThis(WordCacheEntrySizeOfExcludingThis,
|
||||
aMallocSizeOf);
|
||||
aSizes->mShapedWords += mWordCache->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -766,10 +766,7 @@ private:
|
||||
|
||||
void Clear();
|
||||
|
||||
static size_t
|
||||
SizeOfEntryExcludingThis(FontTableHashEntry *aEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf,
|
||||
void* aUserArg);
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
static void DeleteFontTableBlobData(void *aBlobData);
|
||||
@ -2211,16 +2208,16 @@ protected:
|
||||
return aKey->mHashKey;
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(mShapedWord.get());
|
||||
}
|
||||
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
nsAutoPtr<gfxShapedWord> mShapedWord;
|
||||
};
|
||||
|
||||
static size_t
|
||||
WordCacheEntrySizeOfExcludingThis(CacheHashEntry* aHashEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf,
|
||||
void* aUserArg);
|
||||
|
||||
nsAutoPtr<nsTHashtable<CacheHashEntry> > mWordCache;
|
||||
|
||||
static PLDHashOperator AgeCacheEntry(CacheHashEntry *aEntry, void *aUserData);
|
||||
|
@ -1138,14 +1138,6 @@ SizeOfPrefFontEntryExcludingThis
|
||||
return aList.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
static size_t
|
||||
SizeOfStringEntryExcludingThis(nsStringHashKey* aHashEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void* aUserArg)
|
||||
{
|
||||
return aHashEntry->GetKey().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
static size_t
|
||||
SizeOfSharedCmapExcludingThis(CharMapHashKey* aHashEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
@ -1192,8 +1184,7 @@ gfxPlatformFontList::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
|
||||
aMallocSizeOf);
|
||||
|
||||
aSizes->mFontListSize +=
|
||||
mBadUnderlineFamilyNames.SizeOfExcludingThis(SizeOfStringEntryExcludingThis,
|
||||
aMallocSizeOf);
|
||||
mBadUnderlineFamilyNames.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
aSizes->mFontListSize +=
|
||||
mSharedCmaps.SizeOfExcludingThis(SizeOfSharedCmapExcludingThis,
|
||||
|
@ -231,15 +231,7 @@ FramePropertyTable::DeleteAll()
|
||||
size_t
|
||||
FramePropertyTable::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return mEntries.SizeOfExcludingThis(SizeOfPropertyTableEntryExcludingThis,
|
||||
aMallocSizeOf);
|
||||
return mEntries.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
/* static */ size_t
|
||||
FramePropertyTable::SizeOfPropertyTableEntryExcludingThis(Entry* aEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf, void *)
|
||||
{
|
||||
return aEntry->mProp.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
@ -196,15 +196,16 @@ protected:
|
||||
Entry(const Entry &toCopy) :
|
||||
nsPtrHashKey<nsIFrame>(toCopy), mProp(toCopy.mProp) {}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
return mProp.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
PropertyValue mProp;
|
||||
};
|
||||
|
||||
static void DeleteAllForEntry(Entry* aEntry);
|
||||
static PLDHashOperator DeleteEnumerator(Entry* aEntry, void* aArg);
|
||||
|
||||
static size_t SizeOfPropertyTableEntryExcludingThis(Entry* aEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf, void *);
|
||||
|
||||
nsTHashtable<Entry> mEntries;
|
||||
nsIFrame* mLastFrame;
|
||||
Entry* mLastEntry;
|
||||
|
@ -112,13 +112,6 @@ nsPresArena::Free(uint32_t aCode, void* aPtr)
|
||||
list->mEntries.AppendElement(aPtr);
|
||||
}
|
||||
|
||||
/* static */ size_t
|
||||
nsPresArena::SizeOfFreeListEntryExcludingThis(
|
||||
FreeList* aEntry, mozilla::MallocSizeOf aMallocSizeOf, void*)
|
||||
{
|
||||
return aEntry->mEntries.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
struct EnumerateData {
|
||||
nsArenaMemoryStats* stats;
|
||||
size_t total;
|
||||
@ -192,8 +185,7 @@ nsPresArena::AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
// we've not measured explicitly.
|
||||
|
||||
size_t mallocSize = PL_SizeOfArenaPoolExcludingPool(&mPool, aMallocSizeOf);
|
||||
mallocSize += mFreeLists.SizeOfExcludingThis(SizeOfFreeListEntryExcludingThis,
|
||||
aMallocSizeOf);
|
||||
mallocSize += mFreeLists.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
EnumerateData data = { aArenaStats, 0 };
|
||||
mFreeLists.EnumerateEntries(FreeListEnumerator, &data);
|
||||
|
@ -131,6 +131,9 @@ private:
|
||||
static PLDHashNumber HashKey(KeyTypePointer aKey)
|
||||
{ return NS_PTR_TO_INT32(aKey); }
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{ return mEntries.SizeOfExcludingThis(aMallocSizeOf); }
|
||||
|
||||
enum { ALLOW_MEMMOVE = false };
|
||||
};
|
||||
|
||||
@ -138,9 +141,6 @@ private:
|
||||
static PLDHashOperator UnpoisonFreeList(FreeList* aEntry, void*);
|
||||
#endif
|
||||
static PLDHashOperator FreeListEnumerator(FreeList* aEntry, void* aData);
|
||||
static size_t SizeOfFreeListEntryExcludingThis(FreeList* aEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf,
|
||||
void*);
|
||||
|
||||
nsTHashtable<FreeList> mFreeLists;
|
||||
PLArenaPool mPool;
|
||||
|
@ -507,24 +507,12 @@ CacheFileHandles::Log(CacheFileHandlesEntry *entry)
|
||||
|
||||
// Memory reporting
|
||||
|
||||
namespace { // anon
|
||||
|
||||
size_t
|
||||
CollectHandlesMemory(CacheFileHandles::HandleHashKey* key,
|
||||
mozilla::MallocSizeOf mallocSizeOf,
|
||||
void *arg)
|
||||
{
|
||||
return key->SizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
} // anon
|
||||
|
||||
size_t
|
||||
CacheFileHandles::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
MOZ_ASSERT(CacheFileIOManager::IsOnIOThread());
|
||||
|
||||
return mTable.SizeOfExcludingThis(&CollectHandlesMemory, mallocSizeOf);
|
||||
return mTable.SizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
// Events
|
||||
|
@ -3587,18 +3587,6 @@ CacheIndex::OnFileRenamed(CacheFileHandle *aHandle, nsresult aResult)
|
||||
|
||||
// Memory reporting
|
||||
|
||||
namespace { // anon
|
||||
|
||||
size_t
|
||||
CollectIndexEntryMemory(CacheIndexEntry* aEntry,
|
||||
mozilla::MallocSizeOf mallocSizeOf,
|
||||
void *arg)
|
||||
{
|
||||
return aEntry->SizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
} // anon
|
||||
|
||||
size_t
|
||||
CacheIndex::SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
@ -3624,9 +3612,9 @@ CacheIndex::SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) cons
|
||||
n += mallocSizeOf(mRWBuf);
|
||||
n += mallocSizeOf(mRWHash);
|
||||
|
||||
n += mIndex.SizeOfExcludingThis(&CollectIndexEntryMemory, mallocSizeOf);
|
||||
n += mPendingUpdates.SizeOfExcludingThis(&CollectIndexEntryMemory, mallocSizeOf);
|
||||
n += mTmpJournal.SizeOfExcludingThis(&CollectIndexEntryMemory, mallocSizeOf);
|
||||
n += mIndex.SizeOfExcludingThis(mallocSizeOf);
|
||||
n += mPendingUpdates.SizeOfExcludingThis(mallocSizeOf);
|
||||
n += mTmpJournal.SizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
// mFrecencyArray and mExpirationArray items are reported by
|
||||
// mIndex/mPendingUpdates
|
||||
|
@ -630,14 +630,6 @@ nsCookieEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
return amount;
|
||||
}
|
||||
|
||||
static size_t
|
||||
HostTableEntrySizeOfExcludingThis(nsCookieEntry *aEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void *arg)
|
||||
{
|
||||
return aEntry->SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
size_t
|
||||
CookieDomainTuple::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
@ -649,28 +641,18 @@ CookieDomainTuple::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
return amount;
|
||||
}
|
||||
|
||||
static size_t
|
||||
ReadSetEntrySizeOfExcludingThis(nsCookieKey *aEntry,
|
||||
MallocSizeOf aMallocSizeOf,
|
||||
void *)
|
||||
{
|
||||
return aEntry->SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
size_t
|
||||
DBState::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t amount = 0;
|
||||
|
||||
amount += aMallocSizeOf(this);
|
||||
amount += hostTable.SizeOfExcludingThis(HostTableEntrySizeOfExcludingThis,
|
||||
aMallocSizeOf);
|
||||
amount += hostTable.SizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += hostArray.SizeOfExcludingThis(aMallocSizeOf);
|
||||
for (uint32_t i = 0; i < hostArray.Length(); ++i) {
|
||||
amount += hostArray[i].SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
amount += readSet.SizeOfExcludingThis(ReadSetEntrySizeOfExcludingThis,
|
||||
aMallocSizeOf);
|
||||
amount += readSet.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
@ -951,13 +951,6 @@ nsDNSService::GetDNSCacheEntries(nsTArray<mozilla::net::DNSCacheEntries> *args)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static size_t
|
||||
SizeOfLocalDomainsEntryExcludingThis(nsCStringHashKey* entry,
|
||||
MallocSizeOf mallocSizeOf, void*)
|
||||
{
|
||||
return entry->GetKey().SizeOfExcludingThisMustBeUnshared(mallocSizeOf);
|
||||
}
|
||||
|
||||
size_t
|
||||
nsDNSService::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
@ -969,8 +962,7 @@ nsDNSService::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
size_t n = mallocSizeOf(this);
|
||||
n += mResolver->SizeOfIncludingThis(mallocSizeOf);
|
||||
n += mIPv4OnlyDomains.SizeOfExcludingThisMustBeUnshared(mallocSizeOf);
|
||||
n += mLocalDomains.SizeOfExcludingThis(SizeOfLocalDomainsEntryExcludingThis,
|
||||
mallocSizeOf);
|
||||
n += mLocalDomains.SizeOfExcludingThis(mallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -2223,12 +2223,6 @@ History::FetchPageInfo(VisitData& _place, bool* _exists)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ size_t
|
||||
History::SizeOfEntryExcludingThis(KeyClass* aEntry, mozilla::MallocSizeOf aMallocSizeOf, void *)
|
||||
{
|
||||
return aEntry->array.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(HistoryMallocSizeOf)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2246,7 +2240,7 @@ size_t
|
||||
History::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOfThis)
|
||||
{
|
||||
return aMallocSizeOfThis(this) +
|
||||
mObservers.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOfThis);
|
||||
mObservers.SizeOfExcludingThis(aMallocSizeOfThis);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -190,17 +190,13 @@ private:
|
||||
{
|
||||
NS_NOTREACHED("Do not call me!");
|
||||
}
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return array.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
ObserverArray array;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for nsTHashtable::SizeOfExcludingThis call in
|
||||
* SizeOfIncludingThis().
|
||||
*/
|
||||
static size_t SizeOfEntryExcludingThis(KeyClass* aEntry,
|
||||
mozilla::MallocSizeOf aMallocSizeOf,
|
||||
void*);
|
||||
|
||||
nsTHashtable<KeyClass> mObservers;
|
||||
|
||||
/**
|
||||
|
@ -92,6 +92,15 @@ public:
|
||||
{
|
||||
return mozilla::HashString(*aKey);
|
||||
}
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
// To avoid double-counting, only measure the string if it is unshared.
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return GetKey().SizeOfExcludingThisMustBeUnshared(aMallocSizeOf);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
private:
|
||||
@ -140,6 +149,12 @@ public:
|
||||
}
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
// To avoid double-counting, only measure the string if it is unshared.
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return GetKey().SizeOfExcludingThisMustBeUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
private:
|
||||
const nsString mStr;
|
||||
};
|
||||
@ -169,6 +184,15 @@ public:
|
||||
{
|
||||
return mozilla::HashString(*aKey);
|
||||
}
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
// To avoid double-counting, only measure the string if it is unshared.
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return GetKey().SizeOfExcludingThisMustBeUnshared(aMallocSizeOf);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
private:
|
||||
@ -521,7 +545,7 @@ public:
|
||||
return mozilla::HashString(aKey);
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(mKey);
|
||||
}
|
||||
@ -571,6 +595,11 @@ public:
|
||||
return mozilla::HashString(aKey);
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(mKey);
|
||||
}
|
||||
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user