mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-29 11:57:55 +00:00
Bug 668013 - Add nsHTMLStyleSheet::SizeOf(). r=bz
This commit is contained in:
parent
2f42daa157
commit
b511862894
@ -69,6 +69,7 @@
|
||||
#include "nsIAnimationFrameListener.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "nsIStructuredCloneContainer.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsPresContext;
|
||||
@ -149,6 +150,7 @@ public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsIDocument()
|
||||
@ -1531,8 +1533,6 @@ public:
|
||||
#undef DEPRECATED_OPERATION
|
||||
void WarnOnceAbout(DeprecatedOperations aOperation);
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
|
||||
private:
|
||||
PRUint32 mWarnedAbout;
|
||||
|
||||
|
@ -8383,3 +8383,11 @@ nsIDocument::SizeOf() const
|
||||
return size;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsDocument::SizeOf() const
|
||||
{
|
||||
PRInt64 size = MemoryReporter::GetBasicSize<nsDocument, nsIDocument>(this);
|
||||
size += mAttrStyleSheet ? mAttrStyleSheet->SizeOf() : 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -499,6 +499,7 @@ public:
|
||||
typedef mozilla::dom::Element Element;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
|
||||
using nsINode::GetScriptTypeID;
|
||||
|
||||
|
@ -528,6 +528,43 @@ nsHTMLStyleSheet::List(FILE* out, PRInt32 aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
static
|
||||
PLDHashOperator
|
||||
GetHashEntryAttributesSize(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
|
||||
PRUint32 number, void* aArg)
|
||||
{
|
||||
NS_PRECONDITION(aEntry, "The entry should not be null!");
|
||||
NS_PRECONDITION(aArg, "The passed argument should not be null!");
|
||||
|
||||
MappedAttrTableEntry* entry = static_cast<MappedAttrTableEntry*>(aEntry);
|
||||
PRInt64 size = *static_cast<PRInt64*>(aArg);
|
||||
|
||||
NS_ASSERTION(entry->mAttributes, "entry->mAttributes should not be null!");
|
||||
size += sizeof(*entry->mAttributes);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsHTMLStyleSheet::SizeOf() const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
|
||||
size += mLinkRule ? sizeof(*mLinkRule.get()) : 0;
|
||||
size += mVisitedRule ? sizeof(*mVisitedRule.get()) : 0;
|
||||
size += mActiveRule ? sizeof(*mActiveRule.get()) : 0;
|
||||
size += mTableQuirkColorRule ? sizeof(*mTableQuirkColorRule.get()) : 0;
|
||||
size += mTableTHRule ? sizeof(*mTableTHRule.get()) : 0;
|
||||
|
||||
if (mMappedAttrTable.ops) {
|
||||
size += PL_DHASH_TABLE_SIZE(&mMappedAttrTable) * sizeof(MappedAttrTableEntry);
|
||||
PL_DHashTableEnumerate(const_cast<PLDHashTable*>(&mMappedAttrTable),
|
||||
GetHashEntryAttributesSize, &size);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
// XXX For convenience and backwards compatibility
|
||||
nsresult
|
||||
NS_NewHTMLStyleSheet(nsHTMLStyleSheet** aInstancePtrResult, nsIURI* aURL,
|
||||
@ -567,3 +604,4 @@ NS_NewHTMLStyleSheet(nsHTMLStyleSheet** aInstancePtrResult)
|
||||
*aInstancePtrResult = it; // NS_ADDREF above, or set to null by NS_RELEASE
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,7 @@ public:
|
||||
UniqueMappedAttributes(nsMappedAttributes* aMapped);
|
||||
void DropMappedAttributes(nsMappedAttributes* aMapped);
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
|
||||
private:
|
||||
// These are not supported and are not implemented!
|
||||
|
Loading…
Reference in New Issue
Block a user