Bug 667887 - Implement nsMappedAttributes::SizeOf(). r=jst,bz

This commit is contained in:
Mounir Lamouri 2011-07-19 09:42:14 -07:00
parent 3a70fea833
commit 42346e6d0b
2 changed files with 7 additions and 1 deletions

View File

@ -108,6 +108,12 @@ public:
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
PRInt64 SizeOf() const {
NS_ASSERTION(mAttrCount == mBufferSize,
"mBufferSize and mAttrCount are expected to be the same.");
return sizeof(*this) - sizeof(void*) + mAttrCount * sizeof(InternalAttr);
}
private:
nsMappedAttributes(const nsMappedAttributes& aCopy);
~nsMappedAttributes();

View File

@ -540,7 +540,7 @@ GetHashEntryAttributesSize(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
PRInt64 size = *static_cast<PRInt64*>(aArg);
NS_ASSERTION(entry->mAttributes, "entry->mAttributes should not be null!");
size += sizeof(*entry->mAttributes);
size += entry->mAttributes->SizeOf();
return PL_DHASH_NEXT;
}