зеркало из https://github.com/mozilla/gecko-dev.git
Revised SizeOf methods to add in nsString's, nsIAtom's and nsVoidArray's properly
This commit is contained in:
Родитель
58817386bf
Коммит
a69369de69
|
@ -19,6 +19,7 @@
|
|||
#include "nsHTMLValue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
const nsHTMLValue nsHTMLValue::kNull;
|
||||
|
||||
|
@ -291,3 +292,13 @@ void nsHTMLValue::ToString(nsString& aBuffer) const
|
|||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLValue::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (eHTMLUnit_String == mUnit) {
|
||||
if (!aHandler->HaveSeen(mValue.mString)) {
|
||||
mValue.mString->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
enum nsHTMLUnit {
|
||||
eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
void AppendToString(nsString& aBuffer) const;
|
||||
void ToString(nsString& aBuffer) const;
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
protected:
|
||||
nsHTMLUnit mUnit;
|
||||
|
|
|
@ -123,8 +123,12 @@ struct HTMLAttribute {
|
|||
void
|
||||
HTMLAttribute::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX mAttribute
|
||||
if (!aHandler->HaveSeen(mAttribute)) {
|
||||
mAttribute->SizeOf(aHandler);
|
||||
}
|
||||
aHandler->Add(sizeof(*this));
|
||||
aHandler->Add((size_t) (- ((PRInt32) sizeof(mValue)) ) );
|
||||
mValue.SizeOf(aHandler);
|
||||
if (!aHandler->HaveSeen(mNext)) {
|
||||
mNext->SizeOf(aHandler);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsHTMLValue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
const nsHTMLValue nsHTMLValue::kNull;
|
||||
|
||||
|
@ -291,3 +292,13 @@ void nsHTMLValue::ToString(nsString& aBuffer) const
|
|||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLValue::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (eHTMLUnit_String == mUnit) {
|
||||
if (!aHandler->HaveSeen(mValue.mString)) {
|
||||
mValue.mString->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
enum nsHTMLUnit {
|
||||
eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
void AppendToString(nsString& aBuffer) const;
|
||||
void ToString(nsString& aBuffer) const;
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
protected:
|
||||
nsHTMLUnit mUnit;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
enum nsHTMLUnit {
|
||||
eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
void AppendToString(nsString& aBuffer) const;
|
||||
void ToString(nsString& aBuffer) const;
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
protected:
|
||||
nsHTMLUnit mUnit;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsHTMLValue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
const nsHTMLValue nsHTMLValue::kNull;
|
||||
|
||||
|
@ -291,3 +292,13 @@ void nsHTMLValue::ToString(nsString& aBuffer) const
|
|||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLValue::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (eHTMLUnit_String == mUnit) {
|
||||
if (!aHandler->HaveSeen(mValue.mString)) {
|
||||
mValue.mString->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,11 @@ void
|
|||
Area::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mBase, mHREF, mTarget, mAltText
|
||||
aHandler->Add((size_t) (- ((PRInt32)sizeof(nsString) * 4) ) );
|
||||
mBase.SizeOf(aHandler);
|
||||
mHREF.SizeOf(aHandler);
|
||||
mTarget.SizeOf(aHandler);
|
||||
mAltText.SizeOf(aHandler);
|
||||
aHandler->Add(mNumCoords * sizeof(nscoord));
|
||||
}
|
||||
|
||||
|
@ -712,9 +716,17 @@ NS_IMETHODIMP
|
|||
ImageMapImpl::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mName
|
||||
// XXX mTag
|
||||
// XXX mAreas array slots
|
||||
|
||||
aHandler->Add((size_t) (- ((PRInt32) sizeof(mName))));
|
||||
mName.SizeOf(aHandler);
|
||||
|
||||
if (!aHandler->HaveSeen(mTag)) {
|
||||
mTag->SizeOf(aHandler);
|
||||
}
|
||||
|
||||
aHandler->Add((size_t) (- ((PRInt32) sizeof(mAreas))));
|
||||
mAreas.SizeOf(aHandler);
|
||||
|
||||
PRInt32 i, n = mAreas.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
Area* area = (Area*) mAreas[i];
|
||||
|
|
|
@ -85,7 +85,8 @@ nsHTMLContainer::SizeOf(nsISizeOfHandler* aHandler) const
|
|||
void
|
||||
nsHTMLContainer::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX children array's array of pointers
|
||||
aHandler->Add((size_t) (- (PRInt32)sizeof(mChildren) ) );
|
||||
mChildren.SizeOf(aHandler);
|
||||
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
|
|
|
@ -165,7 +165,7 @@ nsHTMLImageLoader::SizeOf(nsISizeOfHandler* aHandler) const
|
|||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (!aHandler->HaveSeen(mURLSpec)) {
|
||||
aHandler->Add(sizeof(*mURLSpec));/* XXX approximation */
|
||||
mURLSpec->SizeOf(aHandler);
|
||||
}
|
||||
if (!aHandler->HaveSeen(mImageLoader)) {
|
||||
mImageLoader->SizeOf(aHandler);
|
||||
|
|
|
@ -92,7 +92,9 @@ nsHTMLTagContent::SizeOf(nsISizeOfHandler* aHandler) const
|
|||
void
|
||||
nsHTMLTagContent::SizeOfWithoutThis(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX tag
|
||||
if (!aHandler->HaveSeen(mTag)) {
|
||||
mTag->SizeOf(aHandler);
|
||||
}
|
||||
if (!aHandler->HaveSeen(mAttributes)) {
|
||||
mAttributes->SizeOf(aHandler);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,11 @@ void
|
|||
Area::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mBase, mHREF, mTarget, mAltText
|
||||
aHandler->Add((size_t) (- ((PRInt32)sizeof(nsString) * 4) ) );
|
||||
mBase.SizeOf(aHandler);
|
||||
mHREF.SizeOf(aHandler);
|
||||
mTarget.SizeOf(aHandler);
|
||||
mAltText.SizeOf(aHandler);
|
||||
aHandler->Add(mNumCoords * sizeof(nscoord));
|
||||
}
|
||||
|
||||
|
@ -712,9 +716,17 @@ NS_IMETHODIMP
|
|||
ImageMapImpl::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
// XXX mName
|
||||
// XXX mTag
|
||||
// XXX mAreas array slots
|
||||
|
||||
aHandler->Add((size_t) (- ((PRInt32) sizeof(mName))));
|
||||
mName.SizeOf(aHandler);
|
||||
|
||||
if (!aHandler->HaveSeen(mTag)) {
|
||||
mTag->SizeOf(aHandler);
|
||||
}
|
||||
|
||||
aHandler->Add((size_t) (- ((PRInt32) sizeof(mAreas))));
|
||||
mAreas.SizeOf(aHandler);
|
||||
|
||||
PRInt32 i, n = mAreas.Count();
|
||||
for (i = 0; i < n; i++) {
|
||||
Area* area = (Area*) mAreas[i];
|
||||
|
|
|
@ -123,8 +123,12 @@ struct HTMLAttribute {
|
|||
void
|
||||
HTMLAttribute::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
// XXX mAttribute
|
||||
if (!aHandler->HaveSeen(mAttribute)) {
|
||||
mAttribute->SizeOf(aHandler);
|
||||
}
|
||||
aHandler->Add(sizeof(*this));
|
||||
aHandler->Add((size_t) (- ((PRInt32) sizeof(mValue)) ) );
|
||||
mValue.SizeOf(aHandler);
|
||||
if (!aHandler->HaveSeen(mNext)) {
|
||||
mNext->SizeOf(aHandler);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsHTMLValue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
const nsHTMLValue nsHTMLValue::kNull;
|
||||
|
||||
|
@ -291,3 +292,13 @@ void nsHTMLValue::ToString(nsString& aBuffer) const
|
|||
AppendToString(aBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLValue::SizeOf(nsISizeOfHandler* aHandler) const
|
||||
{
|
||||
aHandler->Add(sizeof(*this));
|
||||
if (eHTMLUnit_String == mUnit) {
|
||||
if (!aHandler->HaveSeen(mValue.mString)) {
|
||||
mValue.mString->SizeOf(aHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
enum nsHTMLUnit {
|
||||
eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified
|
||||
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
void AppendToString(nsString& aBuffer) const;
|
||||
void ToString(nsString& aBuffer) const;
|
||||
void SizeOf(nsISizeOfHandler* aHandler) const;
|
||||
|
||||
protected:
|
||||
nsHTMLUnit mUnit;
|
||||
|
|
Загрузка…
Ссылка в новой задаче