all changes are NS_DEBUG only. added a private static member variable to count outstanding webshells; code in constructor and destructor to do the counting; a static member function to retrieve the value; and a global function that calls that

This commit is contained in:
scc%netscape.com 1999-08-27 12:32:20 +00:00
parent 2f9548bba6
commit 5a86efb7dd
2 changed files with 56 additions and 0 deletions

View File

@ -532,8 +532,26 @@ protected:
// if there is no mWindow, this will keep track of the bounds --dwc0001
nsRect mBounds;
#ifdef NS_DEBUG
private:
// We're counting the number of |nsWebShells| to help find leaks
static unsigned long gNumberOfWebShells;
static unsigned long TotalWebShellsInExistence() { return gNumberOfWebShells; }
#endif
};
#ifdef NS_DEBUG
unsigned long nsWebShell::gNumberOfWebShells = 0;
unsigned long
NS_TotalWebShellsInExistence()
{
return nsWebShell::TotalWebShellsInExistence();
}
#endif
//----------------------------------------------------------------------
// Class IID's
@ -640,6 +658,11 @@ nsresult nsWebShell::DestroyPluginHost(void)
// Note: operator new zeros our memory
nsWebShell::nsWebShell()
{
#ifdef NS_DEBUG
// We're counting the number of |nsWebShells| to help find leaks
++gNumberOfWebShells;
#endif
NS_INIT_REFCNT();
mHistoryIndex = -1;
mScrollPref = nsScrollPreference_kAuto;
@ -729,6 +752,11 @@ nsWebShell::~nsWebShell()
DestroyPluginHost();
#ifdef NS_DEBUG
// We're counting the number of |nsWebShells| to help find leaks
--gNumberOfWebShells;
#endif
}
void nsWebShell::InitFrameData(PRBool aCompleteInitScrolling)

View File

@ -532,8 +532,26 @@ protected:
// if there is no mWindow, this will keep track of the bounds --dwc0001
nsRect mBounds;
#ifdef NS_DEBUG
private:
// We're counting the number of |nsWebShells| to help find leaks
static unsigned long gNumberOfWebShells;
static unsigned long TotalWebShellsInExistence() { return gNumberOfWebShells; }
#endif
};
#ifdef NS_DEBUG
unsigned long nsWebShell::gNumberOfWebShells = 0;
unsigned long
NS_TotalWebShellsInExistence()
{
return nsWebShell::TotalWebShellsInExistence();
}
#endif
//----------------------------------------------------------------------
// Class IID's
@ -640,6 +658,11 @@ nsresult nsWebShell::DestroyPluginHost(void)
// Note: operator new zeros our memory
nsWebShell::nsWebShell()
{
#ifdef NS_DEBUG
// We're counting the number of |nsWebShells| to help find leaks
++gNumberOfWebShells;
#endif
NS_INIT_REFCNT();
mHistoryIndex = -1;
mScrollPref = nsScrollPreference_kAuto;
@ -729,6 +752,11 @@ nsWebShell::~nsWebShell()
DestroyPluginHost();
#ifdef NS_DEBUG
// We're counting the number of |nsWebShells| to help find leaks
--gNumberOfWebShells;
#endif
}
void nsWebShell::InitFrameData(PRBool aCompleteInitScrolling)