From 0fc64ebc07d3dc5de1a9d12ca4a55ef9d893c8fd Mon Sep 17 00:00:00 2001 From: "evaughan%netscape.com" Date: Wed, 26 Apr 2000 21:01:57 +0000 Subject: [PATCH] Fixed merge error. Added rods performance code back in. git-svn-id: svn://10.0.0.236/trunk@67262 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresShell.cpp | 82 ++++++++++++++++--- mozilla/layout/generic/nsGfxScrollFrame.cpp | 4 +- .../layout/html/base/src/nsGfxScrollFrame.cpp | 4 +- mozilla/layout/html/base/src/nsPresShell.cpp | 82 ++++++++++++++++--- 4 files changed, 146 insertions(+), 26 deletions(-) diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index e24b3269c4f..d7fafc58c51 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -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 @@ -260,6 +330,7 @@ StackArena::Push() StackMark* oldMarks = mMarks; PRUint32 oldLength = mMarkLength; mMarkLength += MARK_INCREMENT; + void* marks = 0; mMarks = new StackMark[mMarkLength]; nsCRT::memcpy(mMarks, oldMarks, sizeof(StackMark)*oldLength); @@ -2056,12 +2127,6 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand) return inQueue; } -/* -#ifdef DEBUG_evaughan -static PRInt32 gPosted = 0; -#endif -*/ - NS_IMETHODIMP PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) { @@ -2087,11 +2152,6 @@ PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) if (!AlreadyInQueue(aReflowCommand)) { NS_ADDREF(aReflowCommand); rv = (mReflowCommands.AppendElement(aReflowCommand) ? NS_OK : NS_ERROR_OUT_OF_MEMORY); - /* -#ifdef DEBUG_evaughan - printf("ReflowCommandsPosted=%d\n", ++gPosted); -#endif - */ } // Kick off a reflow event if we aren't batching reflows diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index e6cadd57958..8381e37d55e 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -925,8 +925,8 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // there is a chance that by adding the horizonal scrollbar we will // suddenly need a vertical scrollbar. Is a special case but its // important. - if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height) - printf("****Gfx Scrollbar Special case hit!!*****\n"); + //if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height) + // printf("****Gfx Scrollbar Special case hit!!*****\n"); } } else { diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index e6cadd57958..8381e37d55e 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -925,8 +925,8 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // there is a chance that by adding the horizonal scrollbar we will // suddenly need a vertical scrollbar. Is a special case but its // important. - if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height) - printf("****Gfx Scrollbar Special case hit!!*****\n"); + //if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height) + // printf("****Gfx Scrollbar Special case hit!!*****\n"); } } else { diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index e24b3269c4f..d7fafc58c51 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -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 @@ -260,6 +330,7 @@ StackArena::Push() StackMark* oldMarks = mMarks; PRUint32 oldLength = mMarkLength; mMarkLength += MARK_INCREMENT; + void* marks = 0; mMarks = new StackMark[mMarkLength]; nsCRT::memcpy(mMarks, oldMarks, sizeof(StackMark)*oldLength); @@ -2056,12 +2127,6 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand) return inQueue; } -/* -#ifdef DEBUG_evaughan -static PRInt32 gPosted = 0; -#endif -*/ - NS_IMETHODIMP PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) { @@ -2087,11 +2152,6 @@ PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) if (!AlreadyInQueue(aReflowCommand)) { NS_ADDREF(aReflowCommand); rv = (mReflowCommands.AppendElement(aReflowCommand) ? NS_OK : NS_ERROR_OUT_OF_MEMORY); - /* -#ifdef DEBUG_evaughan - printf("ReflowCommandsPosted=%d\n", ++gPosted); -#endif - */ } // Kick off a reflow event if we aren't batching reflows