Add ifdef'ed Performance Reflow Counting code

This commit is contained in:
rods%netscape.com 2000-04-21 14:59:47 +00:00
Родитель 79c27c8b3f
Коммит 9d45d84767
65 изменённых файлов: 890 добавлений и 3 удалений

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

@ -263,6 +263,10 @@ CFLAGS=$(CFLAGS) -DMOZ_MATHML
CFLAGS=$(CFLAGS) -DMOZ_SVG
!endif
!ifdef MOZ_REFLOW_PERF
CFLAGS=$(CFLAGS) -DMOZ_REFLOW_PERF
!endif
#//-----------------------------------------------------------------------
#//

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

@ -85,7 +85,6 @@ typedef enum SelectionRegion{SELECTION_ANCHOR_REGION = 0,
#define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x80
/**
* Presentation shell interface. Presentation shells are the
* controlling point for managing the presentation of a document. The
@ -435,6 +434,12 @@ public:
* Get the flags associated with the VerifyReflow debug tool
*/
static NS_LAYOUT PRInt32 GetVerifyReflowFlags();
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
#endif
};
/**

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

@ -1060,3 +1060,14 @@ nsPresContext::SetDefaultDirection(PRUint8 aDirection)
mDefaultDirection = aDirection;
return NS_OK;
}
#ifdef MOZ_REFLOW_PERF
NS_IMETHODIMP
nsPresContext::CountReflows(const char * aName, PRUint32 aType)
{
if (mShell) {
mShell->CountReflows(aName, aType);
}
return NS_OK;
}
#endif

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

@ -312,6 +312,10 @@ public:
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager) = 0;
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection) = 0;
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection) = 0;
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
#endif
};
// Bit values for StartLoadImage's aImageStatus
@ -334,4 +338,12 @@ extern NS_LAYOUT nsresult
extern NS_LAYOUT nsresult
NS_NewPrintContext(nsIPresContext** aInstancePtrResult);
#ifdef MOZ_REFLOW_PERF
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
aPresContext->CountReflows((_name), (_type));
#else
#define DO_GLOBAL_REFLOW_COUNT(_name, _type)
#endif // MOZ_REFLOW_PERF
#endif /* nsIPresContext_h___ */

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

@ -136,6 +136,76 @@ static NS_DEFINE_CID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);
#undef NOISY
//========================================================================
#ifdef MOZ_REFLOW_PERF
class ReflowCountMgr;
static const char * kGrandTotalsStr = "Grand Totals";
#define NUM_REFLOW_TYPES 5
// Counting Class
class ReflowCounter {
public:
ReflowCounter(ReflowCountMgr * aMgr);
~ReflowCounter();
void ClearTotals();
void DisplayTotals(const char * aStr);
void DisplayHTMLTotals(const char * aStr);
void Add(nsReflowReason aType) { mTotals[aType]++; mTotal++; }
void Add(nsReflowReason aType, PRUint32 aTotal) { mTotals[aType] += aTotal; mTotal += aTotal; }
protected:
void DisplayTotals(PRUint32 * aArray, const char * aTitle);
void DisplayHTMLTotals(PRUint32 * aArray, const char * aTitle);
PRUint32 mTotals[NUM_REFLOW_TYPES];
PRUint32 mTotal;
ReflowCountMgr * mMgr;
};
// Manager Class
class ReflowCountMgr {
public:
ReflowCountMgr();
//static ReflowCountMgr * GetInstance() { return &gReflowCountMgr; }
~ReflowCountMgr();
void ClearTotals();
void DisplayTotals(const char * aStr);
void DisplayHTMLTotals(const char * aStr);
void Add(const char * aName, nsReflowReason aType);
ReflowCounter * LookUp(const char * aName);
FILE * GetOutFile() { return mFD; }
protected:
void DisplayTotals(PRUint32 * aArray, PRUint32 * aDupArray, char * aTitle);
void DisplayHTMLTotals(PRUint32 * aArray, PRUint32 * aDupArray, char * aTitle);
static PRIntn RemoveItems(PLHashEntry *he, PRIntn i, void *arg);
void CleanUp();
// stdout Output Methods
static PRIntn DoSingleTotal(PLHashEntry *he, PRIntn i, void *arg);
void DoGrandTotals();
// HTML Output Methods
static PRIntn DoSingleHTMLTotal(PLHashEntry *he, PRIntn i, void *arg);
void DoGrandHTMLTotals();
PLHashTable * mCounts;
FILE * mFD;
// ReflowCountMgr gReflowCountMgr;
};
#endif
//========================================================================
// comment out to hide caret
#define SHOW_CARET
@ -632,6 +702,10 @@ public:
nsIStyleRule* aStyleRule);
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType);
#endif
protected:
virtual ~PresShell();
@ -696,6 +770,10 @@ protected:
MOZ_TIMER_DECLARE(mReflowWatch) // Used for measuring time spent in reflow
MOZ_TIMER_DECLARE(mFrameCreationWatch) // Used for measuring time spent in frame creation
#ifdef MOZ_REFLOW_PERF
ReflowCountMgr * mReflowCountMgr;
#endif
private:
void FreeDynamicStack();
@ -820,6 +898,10 @@ PresShell::PresShell():mStackArena(nsnull)
mPendingReflowEvent = PR_FALSE;
mBatchReflows = PR_FALSE;
mSubShellMap = nsnull;
#ifdef MOZ_REFLOW_PERF
mReflowCountMgr = new ReflowCountMgr();
#endif
}
NS_IMPL_ADDREF(PresShell)
@ -867,6 +949,23 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
PresShell::~PresShell()
{
#ifdef MOZ_REFLOW_PERF
char * uriStr = nsnull;
if (mDocument) {
nsIURI * uri = mDocument->GetDocumentURL();
if (uri) {
uri->GetPath(&uriStr);
NS_RELEASE(uri);
}
}
mReflowCountMgr->DisplayTotals(uriStr);
mReflowCountMgr->DisplayHTMLTotals(uriStr);
delete mReflowCountMgr;
mReflowCountMgr = nsnull;
if (uriStr) delete [] uriStr;
#endif
// if we allocated any stack memory free it.
FreeDynamicStack();
@ -917,6 +1016,7 @@ PresShell::~PresShell()
mPendingReflowEvent = PR_FALSE;
mEventQueue->RevokeEvents(this);
}
}
/**
@ -4160,3 +4260,282 @@ nsresult CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet)
return rv;
}
//-------------------------------------------------------------
//-- Reflow counts
//-------------------------------------------------------------
#ifdef MOZ_REFLOW_PERF
//-------------------------------------------------------------
NS_IMETHODIMP
PresShell::CountReflows(const char * aName, PRUint32 aType)
{
if (mReflowCountMgr) {
mReflowCountMgr->Add(aName, (nsReflowReason)aType);
}
return NS_OK;
}
//------------------------------------------------------------------
//-- Reflow Counter Classes Impls
//------------------------------------------------------------------
//ReflowCountMgr ReflowCountMgr::gReflowCountMgr;
//------------------------------------------------------------------
ReflowCounter::ReflowCounter(ReflowCountMgr * aMgr) :
mMgr(aMgr)
{
ClearTotals();
}
//------------------------------------------------------------------
ReflowCounter::~ReflowCounter()
{
//DisplayTotals(mTotals, "Grand Totals");
}
//------------------------------------------------------------------
void ReflowCounter::ClearTotals()
{
mTotal = 0;
for (PRUint32 i=0;i<NUM_REFLOW_TYPES;i++) {
mTotals[i] = 0;
}
}
//------------------------------------------------------------------
void ReflowCounter::DisplayTotals(const char * aStr)
{
DisplayTotals(mTotals,aStr?aStr:"Totals");
}
//------------------------------------------------------------------
void ReflowCounter::DisplayHTMLTotals(const char * aStr)
{
DisplayHTMLTotals(mTotals, aStr?aStr:"Totals");
}
//------------------------------------------------------------------
void ReflowCounter::DisplayTotals(PRUint32 * aArray, const char * aTitle)
{
if (mTotal == 0) {
return;
}
ReflowCounter * gTots = (ReflowCounter *)mMgr->LookUp(kGrandTotalsStr);
printf("%25s\t", aTitle);
PRUint32 i;
for (i=0;i<NUM_REFLOW_TYPES;i++) {
printf("%d\t", aArray[i]);
if (gTots != this && aArray[i] > 0) {
gTots->Add((nsReflowReason)i, aArray[i]);
//ReflowCountMgr * staticMgr = ReflowCountMgr::GetInstance();
//if (staticMgr != mMgr) {
// staticMgr->Add(aTitle, (nsReflowReason)aArray[i]);
//}
}
}
printf("%d\n", mTotal);
}
//------------------------------------------------------------------
void ReflowCounter::DisplayHTMLTotals(PRUint32 * aArray, const char * aTitle)
{
if (mTotal == 0) {
return;
}
ReflowCounter * gTots = (ReflowCounter *)mMgr->LookUp(kGrandTotalsStr);
FILE * fd = mMgr->GetOutFile();
if (!fd) {
return;
}
PRUint32 i;
fprintf(fd, "<tr><td><center>%s</center></td>", aTitle);
for (i=0;i<NUM_REFLOW_TYPES;i++) {
fprintf(fd, "<td><center>");
if (aArray[i]) {
fprintf(fd, "%d", aArray[i]);
} else {
fprintf(fd, "&nbsp;");
}
fprintf(fd, "</center></td>");
if (gTots != this && aArray[i] > 0) {
gTots->Add((nsReflowReason)i, aArray[i]);
}
}
fprintf(fd, "<td><center>%d</center></td></tr>\n", mTotal);
}
//------------------------------------------------------------------
ReflowCountMgr::ReflowCountMgr()
{
mCounts = PL_NewHashTable(10, PL_HashString, PL_CompareStrings,
PL_CompareValues, nsnull, nsnull);
}
//------------------------------------------------------------------
ReflowCountMgr::~ReflowCountMgr()
{
//if (GetInstance() == this) {
// DoGrandTotals();
//}
CleanUp();
}
//------------------------------------------------------------------
ReflowCounter * ReflowCountMgr::LookUp(const char * aName)
{
if (nsnull != mCounts) {
ReflowCounter * counter = (ReflowCounter *)PL_HashTableLookup(mCounts, aName);
return counter;
}
return nsnull;
}
//------------------------------------------------------------------
void ReflowCountMgr::Add(const char * aName, nsReflowReason aType)
{
if (nsnull != mCounts) {
ReflowCounter * counter = (ReflowCounter *)PL_HashTableLookup(mCounts, aName);
if (counter == nsnull) {
counter = new ReflowCounter(this);
NS_ASSERTION(counter != nsnull, "null ptr");
char * name = nsCRT::strdup(aName);
NS_ASSERTION(name != nsnull, "null ptr");
PL_HashTableAdd(mCounts, name, counter);
}
counter->Add(aType);
}
}
//------------------------------------------------------------------
PRIntn ReflowCountMgr::RemoveItems(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
ReflowCounter * counter = (ReflowCounter *)he->value;
delete counter;
delete [] str;
return HT_ENUMERATE_REMOVE;
}
//------------------------------------------------------------------
void ReflowCountMgr::CleanUp()
{
if (nsnull != mCounts) {
PL_HashTableEnumerateEntries(mCounts, RemoveItems, nsnull);
PL_HashTableDestroy(mCounts);
mCounts = nsnull;
}
}
//------------------------------------------------------------------
PRIntn ReflowCountMgr::DoSingleTotal(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
ReflowCounter * counter = (ReflowCounter *)he->value;
counter->DisplayTotals(str);
return HT_ENUMERATE_NEXT;
}
//------------------------------------------------------------------
void ReflowCountMgr::DoGrandTotals()
{
if (nsnull != mCounts) {
ReflowCounter * gTots = (ReflowCounter *)PL_HashTableLookup(mCounts, kGrandTotalsStr);
if (gTots == nsnull) {
gTots = new ReflowCounter(this);
PL_HashTableAdd(mCounts, nsCRT::strdup(kGrandTotalsStr), gTots);
} else {
gTots->ClearTotals();
}
static const char * title[] = {"Init", "Incrm", "Resze", "Style", "Dirty", "Total"};
printf("\t\t\t");
PRUint32 i;
for (i=0;i<NUM_REFLOW_TYPES+1;i++) {
printf("\t%s", title[i]);
}
printf("\n");
for (i=0;i<78;i++) {
printf("-");
}
printf("\n");
PL_HashTableEnumerateEntries(mCounts, DoSingleTotal, this);
}
}
//------------------------------------------------------------------
PRIntn ReflowCountMgr::DoSingleHTMLTotal(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
ReflowCounter * counter = (ReflowCounter *)he->value;
counter->DisplayHTMLTotals(str);
return HT_ENUMERATE_NEXT;
}
//------------------------------------------------------------------
void ReflowCountMgr::DoGrandHTMLTotals()
{
if (nsnull != mCounts) {
ReflowCounter * gTots = (ReflowCounter *)PL_HashTableLookup(mCounts, kGrandTotalsStr);
if (gTots == nsnull) {
gTots = new ReflowCounter(this);
PL_HashTableAdd(mCounts, nsCRT::strdup(kGrandTotalsStr), gTots);
} else {
gTots->ClearTotals();
}
static const char * title[] = {"Class", "Init", "Incrm", "Resze", "Style", "Dirty", "Total"};
fprintf(mFD, "<tr>");
PRUint32 i;
for (i=0;i<NUM_REFLOW_TYPES+2;i++) {
fprintf(mFD, "<td><center><b>%s<b></center></td>", title[i]);
}
fprintf(mFD, "</tr>\n");
PL_HashTableEnumerateEntries(mCounts, DoSingleHTMLTotal, this);
}
}
//------------------------------------
void ReflowCountMgr::DisplayTotals(const char * aStr)
{
printf("%s\n", aStr?aStr:"No name");
DoGrandTotals();
}
//------------------------------------
void ReflowCountMgr::DisplayHTMLTotals(const char * aStr)
{
#ifdef WIN32 // XXX NOT XP!
char name[1024];
char * sptr = strrchr(aStr, '/');
if (sptr) {
sptr++;
strcpy(name, sptr);
char * eptr = strrchr(name, '.');
if (eptr) {
*eptr = 0;
}
strcat(name, "_stats.html");
}
mFD = fopen(name, "w");
if (mFD) {
fprintf(mFD, "<html><head><title>Reflow Stats</title></head><body>\n");
const char * title = aStr?aStr:"No name";
fprintf(mFD, "<center><b>%s</b><br><table border=1 style=\"background-color:#e0e0e0\">", title);
DoGrandHTMLTotals();
fprintf(mFD, "</center></table>\n");
fprintf(mFD, "</body></html>\n");
fclose(mFD);
mFD = nsnull;
}
#endif // not XP!
}
#endif // MOZ_REFLOW_PERF

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

@ -312,6 +312,10 @@ public:
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager) = 0;
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection) = 0;
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection) = 0;
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
#endif
};
// Bit values for StartLoadImage's aImageStatus
@ -334,4 +338,12 @@ extern NS_LAYOUT nsresult
extern NS_LAYOUT nsresult
NS_NewPrintContext(nsIPresContext** aInstancePtrResult);
#ifdef MOZ_REFLOW_PERF
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
aPresContext->CountReflows((_name), (_type));
#else
#define DO_GLOBAL_REFLOW_COUNT(_name, _type)
#endif // MOZ_REFLOW_PERF
#endif /* nsIPresContext_h___ */

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

@ -85,7 +85,6 @@ typedef enum SelectionRegion{SELECTION_ANCHOR_REGION = 0,
#define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x80
/**
* Presentation shell interface. Presentation shells are the
* controlling point for managing the presentation of a document. The
@ -435,6 +434,12 @@ public:
* Get the flags associated with the VerifyReflow debug tool
*/
static NS_LAYOUT PRInt32 GetVerifyReflowFlags();
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
#endif
};
/**

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

@ -312,6 +312,10 @@ public:
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager) = 0;
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection) = 0;
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection) = 0;
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType) = 0;
#endif
};
// Bit values for StartLoadImage's aImageStatus
@ -334,4 +338,12 @@ extern NS_LAYOUT nsresult
extern NS_LAYOUT nsresult
NS_NewPrintContext(nsIPresContext** aInstancePtrResult);
#ifdef MOZ_REFLOW_PERF
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
aPresContext->CountReflows((_name), (_type));
#else
#define DO_GLOBAL_REFLOW_COUNT(_name, _type)
#endif // MOZ_REFLOW_PERF
#endif /* nsIPresContext_h___ */

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

@ -474,6 +474,7 @@ nsFrameImageLoader::Notify(nsIImageRequest *aImageRequest,
mImageLoadStatus |= NS_IMAGE_LOAD_STATUS_IMAGE_READY;
DamageRepairFrames(nsnull);
}
NotifyFrames(PR_FALSE);
break;
case nsImageNotification_kFrameComplete:

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

@ -1060,3 +1060,14 @@ nsPresContext::SetDefaultDirection(PRUint8 aDirection)
mDefaultDirection = aDirection;
return NS_OK;
}
#ifdef MOZ_REFLOW_PERF
NS_IMETHODIMP
nsPresContext::CountReflows(const char * aName, PRUint32 aType)
{
if (mShell) {
mShell->CountReflows(aName, aType);
}
return NS_OK;
}
#endif

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

@ -133,7 +133,9 @@ public:
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager);
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection);
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection);
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType);
#endif
protected:
nsPresContext();
virtual ~nsPresContext();

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

@ -180,6 +180,7 @@ nsAbsoluteContainingBlock::Reflow(nsIFrame* aDelegatingFrame,
nscoord aContainingBlockHeight,
nsRect& aChildBounds)
{
DO_GLOBAL_REFLOW_COUNT("nsAbsoluteContainingBlock", aReflowState.reason);
// Initialize OUT parameter
aChildBounds.SetRect(0, 0, 0, 0);

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

@ -207,6 +207,7 @@ nsAreaFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsAreaFrame", aReflowState.reason);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsAreaFrame::Reflow: maxSize=%d,%d reason=%d",
aReflowState.availableWidth,

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

@ -108,6 +108,7 @@ BRFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("BRFrame", aReflowState.reason);
if (aMetrics.maxElementSize) {
aMetrics.maxElementSize->width = 0;
aMetrics.maxElementSize->height = 0;

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

@ -1420,6 +1420,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

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

@ -1420,6 +1420,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

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

@ -1420,6 +1420,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

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

@ -1063,6 +1063,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame", aReflowState.reason);
if (eReflowReason_Incremental == aReflowState.reason) {
nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type);

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

@ -214,6 +214,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aReflowStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame", aReflowState.reason);
nsresult rv = NS_OK;
// Grab overflow list

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

@ -1412,6 +1412,7 @@ nsFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFrame", aReflowState.reason);
aDesiredSize.width = 0;
aDesiredSize.height = 0;
aDesiredSize.ascent = 0;

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

@ -527,6 +527,7 @@ nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxScrollFrame", aReflowState.reason);
nsresult rv = nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
/*

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

@ -222,6 +222,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("CanvasFrame", aReflowState.reason);
NS_FRAME_TRACE_REFLOW_IN("CanvasFrame::Reflow");
NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");

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

@ -319,6 +319,7 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageFrame", aReflowState.reason);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsImageFrame::Reflow: aMaxSize=%d,%d",
aReflowState.availableWidth, aReflowState.availableHeight));

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

@ -219,6 +219,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsInlineFrame", aReflowState.reason);
if (nsnull == aReflowState.mLineLayout) {
return NS_ERROR_INVALID_ARG;
}

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

@ -67,6 +67,7 @@ nsLeafFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsLeafFrame", aReflowState.reason);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",
aReflowState.availableWidth, aReflowState.availableHeight));

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

@ -510,6 +510,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsObjectFrame", aReflowState.reason);
nsresult rv = NS_OK;
char* mimeType = nsnull;
PRUint32 buflen;

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

@ -56,6 +56,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPageFrame", aReflowState.reason);
aStatus = NS_FRAME_COMPLETE; // initialize out parameter
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -49,6 +49,7 @@ nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame", aReflowState.reason);
aDesiredSize.width = 0;
aDesiredSize.height = 0;
aDesiredSize.ascent = 0;

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

@ -206,6 +206,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsSimplePageSequenceFrame", aReflowState.reason);
NS_FRAME_TRACE_REFLOW_IN("nsSimplePageSequenceFrame::Reflow");
aStatus = NS_FRAME_COMPLETE; // we're always complete

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

@ -82,6 +82,7 @@ SpacerFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("SpacerFrame", aReflowState.reason);
aStatus = NS_FRAME_COMPLETE;
// By default, we have no area

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

@ -4054,6 +4054,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTextFrame", aReflowState.reason);
#ifdef NOISY_REFLOW
ListTag(stdout);
printf(": BeginReflow: availableSize=%d,%d\n",

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

@ -482,6 +482,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("ViewportFrame", aReflowState.reason);
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");

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

@ -180,6 +180,7 @@ nsAbsoluteContainingBlock::Reflow(nsIFrame* aDelegatingFrame,
nscoord aContainingBlockHeight,
nsRect& aChildBounds)
{
DO_GLOBAL_REFLOW_COUNT("nsAbsoluteContainingBlock", aReflowState.reason);
// Initialize OUT parameter
aChildBounds.SetRect(0, 0, 0, 0);

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

@ -207,6 +207,7 @@ nsAreaFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsAreaFrame", aReflowState.reason);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsAreaFrame::Reflow: maxSize=%d,%d reason=%d",
aReflowState.availableWidth,

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

@ -108,6 +108,7 @@ BRFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("BRFrame", aReflowState.reason);
if (aMetrics.maxElementSize) {
aMetrics.maxElementSize->width = 0;
aMetrics.maxElementSize->height = 0;

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

@ -1420,6 +1420,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

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

@ -1420,6 +1420,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

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

@ -1420,6 +1420,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

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

@ -1063,6 +1063,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame", aReflowState.reason);
if (eReflowReason_Incremental == aReflowState.reason) {
nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type);

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

@ -214,6 +214,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aReflowStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame", aReflowState.reason);
nsresult rv = NS_OK;
// Grab overflow list

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

@ -1412,6 +1412,7 @@ nsFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFrame", aReflowState.reason);
aDesiredSize.width = 0;
aDesiredSize.height = 0;
aDesiredSize.ascent = 0;

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

@ -527,6 +527,7 @@ nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxScrollFrame", aReflowState.reason);
nsresult rv = nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
/*

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

@ -176,6 +176,7 @@ HRuleFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("HRuleFrame", aReflowState.reason);
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
// Compute the width

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

@ -222,6 +222,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("CanvasFrame", aReflowState.reason);
NS_FRAME_TRACE_REFLOW_IN("CanvasFrame::Reflow");
NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");

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

@ -319,6 +319,7 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageFrame", aReflowState.reason);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsImageFrame::Reflow: aMaxSize=%d,%d",
aReflowState.availableWidth, aReflowState.availableHeight));

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

@ -219,6 +219,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsInlineFrame", aReflowState.reason);
if (nsnull == aReflowState.mLineLayout) {
return NS_ERROR_INVALID_ARG;
}

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

@ -67,6 +67,7 @@ nsLeafFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsLeafFrame", aReflowState.reason);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",
aReflowState.availableWidth, aReflowState.availableHeight));

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

@ -510,6 +510,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsObjectFrame", aReflowState.reason);
nsresult rv = NS_OK;
char* mimeType = nsnull;
PRUint32 buflen;

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

@ -56,6 +56,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPageFrame", aReflowState.reason);
aStatus = NS_FRAME_COMPLETE; // initialize out parameter
if (eReflowReason_Incremental == aReflowState.reason) {

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

@ -49,6 +49,7 @@ nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame", aReflowState.reason);
aDesiredSize.width = 0;
aDesiredSize.height = 0;
aDesiredSize.ascent = 0;

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

@ -136,6 +136,76 @@ static NS_DEFINE_CID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID);
#undef NOISY
//========================================================================
#ifdef MOZ_REFLOW_PERF
class ReflowCountMgr;
static const char * kGrandTotalsStr = "Grand Totals";
#define NUM_REFLOW_TYPES 5
// Counting Class
class ReflowCounter {
public:
ReflowCounter(ReflowCountMgr * aMgr);
~ReflowCounter();
void ClearTotals();
void DisplayTotals(const char * aStr);
void DisplayHTMLTotals(const char * aStr);
void Add(nsReflowReason aType) { mTotals[aType]++; mTotal++; }
void Add(nsReflowReason aType, PRUint32 aTotal) { mTotals[aType] += aTotal; mTotal += aTotal; }
protected:
void DisplayTotals(PRUint32 * aArray, const char * aTitle);
void DisplayHTMLTotals(PRUint32 * aArray, const char * aTitle);
PRUint32 mTotals[NUM_REFLOW_TYPES];
PRUint32 mTotal;
ReflowCountMgr * mMgr;
};
// Manager Class
class ReflowCountMgr {
public:
ReflowCountMgr();
//static ReflowCountMgr * GetInstance() { return &gReflowCountMgr; }
~ReflowCountMgr();
void ClearTotals();
void DisplayTotals(const char * aStr);
void DisplayHTMLTotals(const char * aStr);
void Add(const char * aName, nsReflowReason aType);
ReflowCounter * LookUp(const char * aName);
FILE * GetOutFile() { return mFD; }
protected:
void DisplayTotals(PRUint32 * aArray, PRUint32 * aDupArray, char * aTitle);
void DisplayHTMLTotals(PRUint32 * aArray, PRUint32 * aDupArray, char * aTitle);
static PRIntn RemoveItems(PLHashEntry *he, PRIntn i, void *arg);
void CleanUp();
// stdout Output Methods
static PRIntn DoSingleTotal(PLHashEntry *he, PRIntn i, void *arg);
void DoGrandTotals();
// HTML Output Methods
static PRIntn DoSingleHTMLTotal(PLHashEntry *he, PRIntn i, void *arg);
void DoGrandHTMLTotals();
PLHashTable * mCounts;
FILE * mFD;
// ReflowCountMgr gReflowCountMgr;
};
#endif
//========================================================================
// comment out to hide caret
#define SHOW_CARET
@ -632,6 +702,10 @@ public:
nsIStyleRule* aStyleRule);
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType);
#endif
protected:
virtual ~PresShell();
@ -696,6 +770,10 @@ protected:
MOZ_TIMER_DECLARE(mReflowWatch) // Used for measuring time spent in reflow
MOZ_TIMER_DECLARE(mFrameCreationWatch) // Used for measuring time spent in frame creation
#ifdef MOZ_REFLOW_PERF
ReflowCountMgr * mReflowCountMgr;
#endif
private:
void FreeDynamicStack();
@ -820,6 +898,10 @@ PresShell::PresShell():mStackArena(nsnull)
mPendingReflowEvent = PR_FALSE;
mBatchReflows = PR_FALSE;
mSubShellMap = nsnull;
#ifdef MOZ_REFLOW_PERF
mReflowCountMgr = new ReflowCountMgr();
#endif
}
NS_IMPL_ADDREF(PresShell)
@ -867,6 +949,23 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
PresShell::~PresShell()
{
#ifdef MOZ_REFLOW_PERF
char * uriStr = nsnull;
if (mDocument) {
nsIURI * uri = mDocument->GetDocumentURL();
if (uri) {
uri->GetPath(&uriStr);
NS_RELEASE(uri);
}
}
mReflowCountMgr->DisplayTotals(uriStr);
mReflowCountMgr->DisplayHTMLTotals(uriStr);
delete mReflowCountMgr;
mReflowCountMgr = nsnull;
if (uriStr) delete [] uriStr;
#endif
// if we allocated any stack memory free it.
FreeDynamicStack();
@ -917,6 +1016,7 @@ PresShell::~PresShell()
mPendingReflowEvent = PR_FALSE;
mEventQueue->RevokeEvents(this);
}
}
/**
@ -4160,3 +4260,282 @@ nsresult CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet)
return rv;
}
//-------------------------------------------------------------
//-- Reflow counts
//-------------------------------------------------------------
#ifdef MOZ_REFLOW_PERF
//-------------------------------------------------------------
NS_IMETHODIMP
PresShell::CountReflows(const char * aName, PRUint32 aType)
{
if (mReflowCountMgr) {
mReflowCountMgr->Add(aName, (nsReflowReason)aType);
}
return NS_OK;
}
//------------------------------------------------------------------
//-- Reflow Counter Classes Impls
//------------------------------------------------------------------
//ReflowCountMgr ReflowCountMgr::gReflowCountMgr;
//------------------------------------------------------------------
ReflowCounter::ReflowCounter(ReflowCountMgr * aMgr) :
mMgr(aMgr)
{
ClearTotals();
}
//------------------------------------------------------------------
ReflowCounter::~ReflowCounter()
{
//DisplayTotals(mTotals, "Grand Totals");
}
//------------------------------------------------------------------
void ReflowCounter::ClearTotals()
{
mTotal = 0;
for (PRUint32 i=0;i<NUM_REFLOW_TYPES;i++) {
mTotals[i] = 0;
}
}
//------------------------------------------------------------------
void ReflowCounter::DisplayTotals(const char * aStr)
{
DisplayTotals(mTotals,aStr?aStr:"Totals");
}
//------------------------------------------------------------------
void ReflowCounter::DisplayHTMLTotals(const char * aStr)
{
DisplayHTMLTotals(mTotals, aStr?aStr:"Totals");
}
//------------------------------------------------------------------
void ReflowCounter::DisplayTotals(PRUint32 * aArray, const char * aTitle)
{
if (mTotal == 0) {
return;
}
ReflowCounter * gTots = (ReflowCounter *)mMgr->LookUp(kGrandTotalsStr);
printf("%25s\t", aTitle);
PRUint32 i;
for (i=0;i<NUM_REFLOW_TYPES;i++) {
printf("%d\t", aArray[i]);
if (gTots != this && aArray[i] > 0) {
gTots->Add((nsReflowReason)i, aArray[i]);
//ReflowCountMgr * staticMgr = ReflowCountMgr::GetInstance();
//if (staticMgr != mMgr) {
// staticMgr->Add(aTitle, (nsReflowReason)aArray[i]);
//}
}
}
printf("%d\n", mTotal);
}
//------------------------------------------------------------------
void ReflowCounter::DisplayHTMLTotals(PRUint32 * aArray, const char * aTitle)
{
if (mTotal == 0) {
return;
}
ReflowCounter * gTots = (ReflowCounter *)mMgr->LookUp(kGrandTotalsStr);
FILE * fd = mMgr->GetOutFile();
if (!fd) {
return;
}
PRUint32 i;
fprintf(fd, "<tr><td><center>%s</center></td>", aTitle);
for (i=0;i<NUM_REFLOW_TYPES;i++) {
fprintf(fd, "<td><center>");
if (aArray[i]) {
fprintf(fd, "%d", aArray[i]);
} else {
fprintf(fd, "&nbsp;");
}
fprintf(fd, "</center></td>");
if (gTots != this && aArray[i] > 0) {
gTots->Add((nsReflowReason)i, aArray[i]);
}
}
fprintf(fd, "<td><center>%d</center></td></tr>\n", mTotal);
}
//------------------------------------------------------------------
ReflowCountMgr::ReflowCountMgr()
{
mCounts = PL_NewHashTable(10, PL_HashString, PL_CompareStrings,
PL_CompareValues, nsnull, nsnull);
}
//------------------------------------------------------------------
ReflowCountMgr::~ReflowCountMgr()
{
//if (GetInstance() == this) {
// DoGrandTotals();
//}
CleanUp();
}
//------------------------------------------------------------------
ReflowCounter * ReflowCountMgr::LookUp(const char * aName)
{
if (nsnull != mCounts) {
ReflowCounter * counter = (ReflowCounter *)PL_HashTableLookup(mCounts, aName);
return counter;
}
return nsnull;
}
//------------------------------------------------------------------
void ReflowCountMgr::Add(const char * aName, nsReflowReason aType)
{
if (nsnull != mCounts) {
ReflowCounter * counter = (ReflowCounter *)PL_HashTableLookup(mCounts, aName);
if (counter == nsnull) {
counter = new ReflowCounter(this);
NS_ASSERTION(counter != nsnull, "null ptr");
char * name = nsCRT::strdup(aName);
NS_ASSERTION(name != nsnull, "null ptr");
PL_HashTableAdd(mCounts, name, counter);
}
counter->Add(aType);
}
}
//------------------------------------------------------------------
PRIntn ReflowCountMgr::RemoveItems(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
ReflowCounter * counter = (ReflowCounter *)he->value;
delete counter;
delete [] str;
return HT_ENUMERATE_REMOVE;
}
//------------------------------------------------------------------
void ReflowCountMgr::CleanUp()
{
if (nsnull != mCounts) {
PL_HashTableEnumerateEntries(mCounts, RemoveItems, nsnull);
PL_HashTableDestroy(mCounts);
mCounts = nsnull;
}
}
//------------------------------------------------------------------
PRIntn ReflowCountMgr::DoSingleTotal(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
ReflowCounter * counter = (ReflowCounter *)he->value;
counter->DisplayTotals(str);
return HT_ENUMERATE_NEXT;
}
//------------------------------------------------------------------
void ReflowCountMgr::DoGrandTotals()
{
if (nsnull != mCounts) {
ReflowCounter * gTots = (ReflowCounter *)PL_HashTableLookup(mCounts, kGrandTotalsStr);
if (gTots == nsnull) {
gTots = new ReflowCounter(this);
PL_HashTableAdd(mCounts, nsCRT::strdup(kGrandTotalsStr), gTots);
} else {
gTots->ClearTotals();
}
static const char * title[] = {"Init", "Incrm", "Resze", "Style", "Dirty", "Total"};
printf("\t\t\t");
PRUint32 i;
for (i=0;i<NUM_REFLOW_TYPES+1;i++) {
printf("\t%s", title[i]);
}
printf("\n");
for (i=0;i<78;i++) {
printf("-");
}
printf("\n");
PL_HashTableEnumerateEntries(mCounts, DoSingleTotal, this);
}
}
//------------------------------------------------------------------
PRIntn ReflowCountMgr::DoSingleHTMLTotal(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
ReflowCounter * counter = (ReflowCounter *)he->value;
counter->DisplayHTMLTotals(str);
return HT_ENUMERATE_NEXT;
}
//------------------------------------------------------------------
void ReflowCountMgr::DoGrandHTMLTotals()
{
if (nsnull != mCounts) {
ReflowCounter * gTots = (ReflowCounter *)PL_HashTableLookup(mCounts, kGrandTotalsStr);
if (gTots == nsnull) {
gTots = new ReflowCounter(this);
PL_HashTableAdd(mCounts, nsCRT::strdup(kGrandTotalsStr), gTots);
} else {
gTots->ClearTotals();
}
static const char * title[] = {"Class", "Init", "Incrm", "Resze", "Style", "Dirty", "Total"};
fprintf(mFD, "<tr>");
PRUint32 i;
for (i=0;i<NUM_REFLOW_TYPES+2;i++) {
fprintf(mFD, "<td><center><b>%s<b></center></td>", title[i]);
}
fprintf(mFD, "</tr>\n");
PL_HashTableEnumerateEntries(mCounts, DoSingleHTMLTotal, this);
}
}
//------------------------------------
void ReflowCountMgr::DisplayTotals(const char * aStr)
{
printf("%s\n", aStr?aStr:"No name");
DoGrandTotals();
}
//------------------------------------
void ReflowCountMgr::DisplayHTMLTotals(const char * aStr)
{
#ifdef WIN32 // XXX NOT XP!
char name[1024];
char * sptr = strrchr(aStr, '/');
if (sptr) {
sptr++;
strcpy(name, sptr);
char * eptr = strrchr(name, '.');
if (eptr) {
*eptr = 0;
}
strcat(name, "_stats.html");
}
mFD = fopen(name, "w");
if (mFD) {
fprintf(mFD, "<html><head><title>Reflow Stats</title></head><body>\n");
const char * title = aStr?aStr:"No name";
fprintf(mFD, "<center><b>%s</b><br><table border=1 style=\"background-color:#e0e0e0\">", title);
DoGrandHTMLTotals();
fprintf(mFD, "</center></table>\n");
fprintf(mFD, "</body></html>\n");
fclose(mFD);
mFD = nsnull;
}
#endif // not XP!
}
#endif // MOZ_REFLOW_PERF

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

@ -540,6 +540,7 @@ nsScrollFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsScrollFrame", aReflowState.reason);
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("enter nsScrollFrame::Reflow: maxSize=%d,%d",
aReflowState.availableWidth,

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

@ -206,6 +206,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsSimplePageSequenceFrame", aReflowState.reason);
NS_FRAME_TRACE_REFLOW_IN("nsSimplePageSequenceFrame::Reflow");
aStatus = NS_FRAME_COMPLETE; // we're always complete

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

@ -82,6 +82,7 @@ SpacerFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("SpacerFrame", aReflowState.reason);
aStatus = NS_FRAME_COMPLETE;
// By default, we have no area

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

@ -4054,6 +4054,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTextFrame", aReflowState.reason);
#ifdef NOISY_REFLOW
ListTag(stdout);
printf(": BeginReflow: availableSize=%d,%d\n",

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

@ -482,6 +482,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("ViewportFrame", aReflowState.reason);
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");

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

@ -610,6 +610,7 @@ nsBoxFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBoxFrame", aReflowState.reason);
#ifdef DEBUG_REFLOW
gIndent++;
#endif

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

@ -344,6 +344,7 @@ nsBoxToBlockAdaptor::Reflow(nsIPresContext* aPresContext,
nscoord aHeight,
PRBool aMoveFrame)
{
DO_GLOBAL_REFLOW_COUNT("nsBoxToBlockAdaptor", aReflowState.reason);
//printf("width=%d, height=%d\n", aWidth, aHeight);

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

@ -139,6 +139,7 @@ nsLeafBoxFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame", aReflowState.reason);
NS_ASSERTION(aReflowState.mComputedWidth >=0 && aReflowState.mComputedHeight >= 0, "Computed Size < 0");
aStatus = NS_FRAME_COMPLETE;

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

@ -202,6 +202,7 @@ nsRootBoxFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsRootBoxFrame", aReflowState.reason);
return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}

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

@ -140,6 +140,7 @@ NS_IMETHODIMP nsTreeCellFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTreeCellFrame", aReflowState.reason);
//printf("Tree Cell Width: %d, Tree Cell Height: %d\n", aReflowState.mComputedWidth, aReflowState.mComputedHeight);
nsresult rv = nsTableCellFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

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

@ -391,6 +391,7 @@ nsTreeFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTreeFrame", aReflowState.reason);
NS_ASSERTION(aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE,
"Reflowing tree with unconstrained width!!!!");

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

@ -68,6 +68,7 @@ nsTreeIndentationFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTreeIndentationFrame", aReflowState.reason);
aStatus = NS_FRAME_COMPLETE;
// By default, we have no area

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

@ -35,6 +35,7 @@
#include "nsXULAtoms.h"
#include "nsBoxFrame.h"
#include "nsTreeFrame.h"
#include "nsIPresContext.h"
//
// NS_NewTreeOuterFrame
@ -110,6 +111,7 @@ nsTreeOuterFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTreeOuterFrame", aReflowState.reason);
// XXX at the moment we don't handle non incremental dirty reflow commands. So just convert them
// to style changes for now.

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

@ -180,6 +180,7 @@ nsTreeRowFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTreeRowFrame", aReflowState.reason);
/*
if (aReflowState.reason != eReflowReason_Incremental) {
// Determine the row's generation.