Added SizeOf() handler for space manager

This commit is contained in:
troy%netscape.com 1999-10-02 00:52:01 +00:00
Родитель dc46519283
Коммит 6f0d3813a7
10 изменённых файлов: 98 добавлений и 0 удалений

Просмотреть файл

@ -103,6 +103,7 @@ LAYOUT_ATOM(viewportFrame, "ViewportFrame")
LAYOUT_ATOM(cellMap, "TableCellMap")
LAYOUT_ATOM(imageMap, "ImageMap")
LAYOUT_ATOM(lineBox, "LineBox")
LAYOUT_ATOM(spaceManager, "SpaceManager")
LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy")
LAYOUT_ATOM(textRun, "TextRun")
#endif

Просмотреть файл

@ -103,6 +103,7 @@ LAYOUT_ATOM(viewportFrame, "ViewportFrame")
LAYOUT_ATOM(cellMap, "TableCellMap")
LAYOUT_ATOM(imageMap, "ImageMap")
LAYOUT_ATOM(lineBox, "LineBox")
LAYOUT_ATOM(spaceManager, "SpaceManager")
LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy")
LAYOUT_ATOM(textRun, "TextRun")
#endif

Просмотреть файл

@ -24,6 +24,7 @@
class nsIFrame;
class nsVoidArray;
class nsISizeOfHandler;
struct nsSize;
// IID for the nsISpaceManager interface {17C8FB50-BE96-11d1-80B5-00805F8A274D}
@ -187,6 +188,10 @@ public:
* Dump the state of the spacemanager out to a file
*/
NS_IMETHOD List(FILE* out) = 0;
#ifdef DEBUG
virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const = 0;
#endif
};
inline void nsBandTrapezoid::GetRect(nsRect& aRect) const

Просмотреть файл

@ -103,6 +103,7 @@ LAYOUT_ATOM(viewportFrame, "ViewportFrame")
LAYOUT_ATOM(cellMap, "TableCellMap")
LAYOUT_ATOM(imageMap, "ImageMap")
LAYOUT_ATOM(lineBox, "LineBox")
LAYOUT_ATOM(spaceManager, "SpaceManager")
LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy")
LAYOUT_ATOM(textRun, "TextRun")
#endif

Просмотреть файл

@ -1196,3 +1196,34 @@ nsSpaceManager::BandRect::Length() const
return len;
}
#ifdef DEBUG
void
nsSpaceManager::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
*aResult = sizeof(*this);
// Add in the size of the band data. Don't count the header which has
// already been taken into account
if (!mBandList.IsEmpty()) {
const BandRect* bandRect = mBandList.Head();
do {
*aResult += sizeof(*bandRect);
if (bandRect->mNumFrames > 1) {
PRUint32 voidArraySize;
bandRect->mFrames->SizeOf(aHandler, &voidArraySize);
*aResult += voidArraySize;
}
bandRect = bandRect->Next();
} while (bandRect != &mBandList);
}
// Add in the size of the hash table
if (mFrameInfoMap) {
*aResult += sizeof(PLHashTable);
*aResult += (1 << (PL_HASH_BITS - mFrameInfoMap->shift)) * sizeof(PLHashEntry*);
*aResult += mFrameInfoMap->nentries * sizeof(PLHashEntry);
}
}
#endif

Просмотреть файл

@ -56,6 +56,10 @@ public:
NS_IMETHOD ClearRegions();
NS_IMETHOD List(FILE* out);
#ifdef DEBUG
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
#endif
protected:
// Structure that maintains information about the region associated
// with a particular frame

Просмотреть файл

@ -29,6 +29,7 @@
#include "nsHTMLValue.h"
#include "nsHTMLParts.h"
#include "nsLayoutAtoms.h"
#include "nsISizeOfHandler.h"
#undef NOISY_MAX_ELEMENT_SIZE
#undef NOISY_SPACEMANAGER
@ -545,6 +546,15 @@ nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
}
nsBlockFrame::SizeOf(aHandler, aResult);
*aResult += sizeof(*this) - sizeof(nsBlockFrame);
// Add in space taken up by the space manager
if (mSpaceManager) {
PRUint32 spaceManagerSize;
mSpaceManager->SizeOf(aHandler, &spaceManagerSize);
aHandler->AddSize(nsLayoutAtoms::spaceManager, spaceManagerSize);
}
return NS_OK;
}
#endif

Просмотреть файл

@ -1196,3 +1196,34 @@ nsSpaceManager::BandRect::Length() const
return len;
}
#ifdef DEBUG
void
nsSpaceManager::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
*aResult = sizeof(*this);
// Add in the size of the band data. Don't count the header which has
// already been taken into account
if (!mBandList.IsEmpty()) {
const BandRect* bandRect = mBandList.Head();
do {
*aResult += sizeof(*bandRect);
if (bandRect->mNumFrames > 1) {
PRUint32 voidArraySize;
bandRect->mFrames->SizeOf(aHandler, &voidArraySize);
*aResult += voidArraySize;
}
bandRect = bandRect->Next();
} while (bandRect != &mBandList);
}
// Add in the size of the hash table
if (mFrameInfoMap) {
*aResult += sizeof(PLHashTable);
*aResult += (1 << (PL_HASH_BITS - mFrameInfoMap->shift)) * sizeof(PLHashEntry*);
*aResult += mFrameInfoMap->nentries * sizeof(PLHashEntry);
}
}
#endif

Просмотреть файл

@ -56,6 +56,10 @@ public:
NS_IMETHOD ClearRegions();
NS_IMETHOD List(FILE* out);
#ifdef DEBUG
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
#endif
protected:
// Structure that maintains information about the region associated
// with a particular frame

Просмотреть файл

@ -29,6 +29,7 @@
#include "nsHTMLValue.h"
#include "nsHTMLParts.h"
#include "nsLayoutAtoms.h"
#include "nsISizeOfHandler.h"
#undef NOISY_MAX_ELEMENT_SIZE
#undef NOISY_SPACEMANAGER
@ -545,6 +546,15 @@ nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
}
nsBlockFrame::SizeOf(aHandler, aResult);
*aResult += sizeof(*this) - sizeof(nsBlockFrame);
// Add in space taken up by the space manager
if (mSpaceManager) {
PRUint32 spaceManagerSize;
mSpaceManager->SizeOf(aHandler, &spaceManagerSize);
aHandler->AddSize(nsLayoutAtoms::spaceManager, spaceManagerSize);
}
return NS_OK;
}
#endif