Bug 934091 - Add current process ID to the {++|--}{DOMWINDOW|DOCSHELL} debug output r=smaug

From 4ac8092c5148f927e305be79c1667173d456313c Mon Sep 17 00:00:00 2001
This commit is contained in:
Tim Taubert 2013-11-02 11:29:40 +01:00
parent af558e50f1
commit f8403bbf7e
2 changed files with 33 additions and 11 deletions

View File

@ -194,6 +194,11 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#define DEBUG_PAGE_CACHE
#endif
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
#endif
using namespace mozilla;
using namespace mozilla::dom;
@ -795,8 +800,11 @@ nsDocShell::nsDocShell():
// We're counting the number of |nsDocShells| to help find leaks
++gNumberOfDocShells;
if (!PR_GetEnv("MOZ_QUIET")) {
printf("++DOCSHELL %p == %ld [id = %llu]\n", (void*) this,
gNumberOfDocShells, SafeCast<unsigned long long>(mHistoryID));
printf_stderr("++DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
(void*) this,
gNumberOfDocShells,
getpid(),
SafeCast<unsigned long long>(mHistoryID));
}
#endif
}
@ -824,8 +832,11 @@ nsDocShell::~nsDocShell()
// We're counting the number of |nsDocShells| to help find leaks
--gNumberOfDocShells;
if (!PR_GetEnv("MOZ_QUIET")) {
printf("--DOCSHELL %p == %ld [id = %llu]\n", (void*) this,
gNumberOfDocShells, SafeCast<unsigned long long>(mHistoryID));
printf_stderr("--DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
(void*) this,
gNumberOfDocShells,
getpid(),
SafeCast<unsigned long long>(mHistoryID));
}
#endif
}

View File

@ -237,6 +237,11 @@ class nsIScriptTimeoutHandler;
static PRLogModuleInfo* gDOMLeakPRLog;
#endif
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
#endif
static const char kStorageEnabled[] = "dom.storage.enabled";
using namespace mozilla;
@ -1121,10 +1126,12 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
#ifdef DEBUG
if (!PR_GetEnv("MOZ_QUIET")) {
printf("++DOMWINDOW == %d (%p) [serial = %d] [outer = %p]\n", gRefCnt,
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)),
gSerialCounter,
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(aOuterWindow)));
printf_stderr("++DOMWINDOW == %d (%p) [pid = %d] [serial = %d] [outer = %p]\n",
gRefCnt,
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)),
getpid(),
gSerialCounter,
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(aOuterWindow)));
}
#endif
@ -1197,9 +1204,13 @@ nsGlobalWindow::~nsGlobalWindow()
}
nsGlobalWindow* outer = static_cast<nsGlobalWindow*>(mOuterWindow.get());
printf("--DOMWINDOW == %d (%p) [serial = %d] [outer = %p] [url = %s]\n",
gRefCnt, static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)),
mSerial, static_cast<void*>(static_cast<nsIScriptGlobalObject*>(outer)), url.get());
printf_stderr("--DOMWINDOW == %d (%p) [pid = %d] [serial = %d] [outer = %p] [url = %s]\n",
gRefCnt,
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)),
getpid(),
mSerial,
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(outer)),
url.get());
}
#endif