From a4aa98059e8ff570ef6fc1898418b048b46215ef Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Tue, 5 Oct 1999 14:51:12 +0000 Subject: [PATCH] r=troy; Added in ctor/dtor counting git-svn-id: svn://10.0.0.236/trunk@49833 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresShell.cpp | 31 +++++++++++++------- mozilla/layout/generic/nsFrame.cpp | 10 +++++-- mozilla/layout/html/base/src/nsFrame.cpp | 10 +++++-- mozilla/layout/html/base/src/nsPresShell.cpp | 31 +++++++++++++------- 4 files changed, 58 insertions(+), 24 deletions(-) diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index d3bf75e334f..88075404485 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -339,11 +339,12 @@ static PRLogModuleInfo* gLogModule; static PRUint32 gVerifyReflowFlags; -#define VERIFY_REFLOW_ON 0x01 -#define VERIFY_REFLOW_NOISY 0x02 -#define VERIFY_REFLOW_ALL 0x04 -#define VERIFY_REFLOW_DUMP_COMMANDS 0x08 -#define VERIFY_REFLOW_NOISY_RC 0x10 +#define VERIFY_REFLOW_ON 0x01 +#define VERIFY_REFLOW_NOISY 0x02 +#define VERIFY_REFLOW_ALL 0x04 +#define VERIFY_REFLOW_DUMP_COMMANDS 0x08 +#define VERIFY_REFLOW_NOISY_RC 0x10 +#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20 #endif static PRBool gVerifyReflowEnabled; @@ -373,6 +374,9 @@ nsIPresShell::GetVerifyReflowEnable() } if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { printf(" (noisy reflow commands)"); + if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { + printf(" (REALLY noisy reflow commands)"); + } } printf("\n"); } @@ -402,8 +406,11 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult) return it->QueryInterface(kIPresShellIID, (void **) aInstancePtrResult); } +MOZ_DECL_CTOR_COUNTER(PresShell); + PresShell::PresShell() { + MOZ_COUNT_CTOR(PresShell); mIsDestroying = PR_FALSE; mCaretEnabled = PR_FALSE; mDisplayNonTextSelection = PR_FALSE; @@ -493,6 +500,8 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) PresShell::~PresShell() { + MOZ_COUNT_DTOR(PresShell); + mRefCnt = 99;/* XXX hack! get around re-entrancy bugs */ mIsDestroying = PR_TRUE; @@ -1229,11 +1238,13 @@ PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { printf("PresShell@%p: adding reflow command\n", this); aReflowCommand->List(stdout); - printf("Current content model:\n"); - nsCOMPtr rootContent; - rootContent = getter_AddRefs(mDocument->GetRootContent()); - if (rootContent) { - rootContent->List(stdout, 0); + if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { + printf("Current content model:\n"); + nsCOMPtr rootContent; + rootContent = getter_AddRefs(mDocument->GetRootContent()); + if (rootContent) { + rootContent->List(stdout, 0); + } } } } diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index f9ca3398fe7..3dca95d16d0 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -193,13 +193,20 @@ NS_NewEmptyFrame(nsIFrame** aNewFrame) NS_IMPL_ZEROING_OPERATOR_NEW(nsFrame) +MOZ_DECL_CTOR_COUNTER(nsFrame); + nsFrame::nsFrame() { - mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW | NS_FRAME_IS_DIRTY; + MOZ_COUNT_CTOR(nsFrame); + + mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW | + NS_FRAME_IS_DIRTY; } nsFrame::~nsFrame() { + MOZ_COUNT_DTOR(nsFrame); + NS_IF_RELEASE(mContent); NS_IF_RELEASE(mStyleContext); if (nsnull != mView) { @@ -207,7 +214,6 @@ nsFrame::~nsFrame() mView->Destroy(); mView = nsnull; } - } ///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index f9ca3398fe7..3dca95d16d0 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -193,13 +193,20 @@ NS_NewEmptyFrame(nsIFrame** aNewFrame) NS_IMPL_ZEROING_OPERATOR_NEW(nsFrame) +MOZ_DECL_CTOR_COUNTER(nsFrame); + nsFrame::nsFrame() { - mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW | NS_FRAME_IS_DIRTY; + MOZ_COUNT_CTOR(nsFrame); + + mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW | + NS_FRAME_IS_DIRTY; } nsFrame::~nsFrame() { + MOZ_COUNT_DTOR(nsFrame); + NS_IF_RELEASE(mContent); NS_IF_RELEASE(mStyleContext); if (nsnull != mView) { @@ -207,7 +214,6 @@ nsFrame::~nsFrame() mView->Destroy(); mView = nsnull; } - } ///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index d3bf75e334f..88075404485 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -339,11 +339,12 @@ static PRLogModuleInfo* gLogModule; static PRUint32 gVerifyReflowFlags; -#define VERIFY_REFLOW_ON 0x01 -#define VERIFY_REFLOW_NOISY 0x02 -#define VERIFY_REFLOW_ALL 0x04 -#define VERIFY_REFLOW_DUMP_COMMANDS 0x08 -#define VERIFY_REFLOW_NOISY_RC 0x10 +#define VERIFY_REFLOW_ON 0x01 +#define VERIFY_REFLOW_NOISY 0x02 +#define VERIFY_REFLOW_ALL 0x04 +#define VERIFY_REFLOW_DUMP_COMMANDS 0x08 +#define VERIFY_REFLOW_NOISY_RC 0x10 +#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20 #endif static PRBool gVerifyReflowEnabled; @@ -373,6 +374,9 @@ nsIPresShell::GetVerifyReflowEnable() } if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { printf(" (noisy reflow commands)"); + if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { + printf(" (REALLY noisy reflow commands)"); + } } printf("\n"); } @@ -402,8 +406,11 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult) return it->QueryInterface(kIPresShellIID, (void **) aInstancePtrResult); } +MOZ_DECL_CTOR_COUNTER(PresShell); + PresShell::PresShell() { + MOZ_COUNT_CTOR(PresShell); mIsDestroying = PR_FALSE; mCaretEnabled = PR_FALSE; mDisplayNonTextSelection = PR_FALSE; @@ -493,6 +500,8 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) PresShell::~PresShell() { + MOZ_COUNT_DTOR(PresShell); + mRefCnt = 99;/* XXX hack! get around re-entrancy bugs */ mIsDestroying = PR_TRUE; @@ -1229,11 +1238,13 @@ PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { printf("PresShell@%p: adding reflow command\n", this); aReflowCommand->List(stdout); - printf("Current content model:\n"); - nsCOMPtr rootContent; - rootContent = getter_AddRefs(mDocument->GetRootContent()); - if (rootContent) { - rootContent->List(stdout, 0); + if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { + printf("Current content model:\n"); + nsCOMPtr rootContent; + rootContent = getter_AddRefs(mDocument->GetRootContent()); + if (rootContent) { + rootContent->List(stdout, 0); + } } } }