Bug 673252 - Allow +++DOCSHELL and +++DOMWINDOW printfs to be silenced via MOZ_QUIET environment variable. r=bz

This commit is contained in:
Justin Lebar
2011-08-04 11:43:50 -04:00
parent c401408f10
commit ead86f9af0
2 changed files with 22 additions and 16 deletions

View File

@@ -66,6 +66,7 @@
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsRect.h" #include "nsRect.h"
#include "prprf.h" #include "prprf.h"
#include "prenv.h"
#include "nsIMarkupDocumentViewer.h" #include "nsIMarkupDocumentViewer.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
@@ -780,9 +781,9 @@ nsDocShell::nsDocShell():
#ifdef DEBUG #ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks // We're counting the number of |nsDocShells| to help find leaks
++gNumberOfDocShells; ++gNumberOfDocShells;
#endif if (!PR_GetEnv("MOZ_QUIET")) {
#ifdef DEBUG printf("++DOCSHELL %p == %ld\n", (void*) this, gNumberOfDocShells);
printf("++DOCSHELL %p == %ld\n", (void*) this, gNumberOfDocShells); }
#endif #endif
} }
@@ -808,9 +809,9 @@ nsDocShell::~nsDocShell()
#ifdef DEBUG #ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks // We're counting the number of |nsDocShells| to help find leaks
--gNumberOfDocShells; --gNumberOfDocShells;
#endif if (!PR_GetEnv("MOZ_QUIET")) {
#ifdef DEBUG printf("--DOCSHELL %p == %ld\n", (void*) this, gNumberOfDocShells);
printf("--DOCSHELL %p == %ld\n", (void*) this, gNumberOfDocShells); }
#endif #endif
} }

View File

@@ -235,6 +235,7 @@
#define FORCE_PR_LOG 1 #define FORCE_PR_LOG 1
#endif #endif
#include "prlog.h" #include "prlog.h"
#include "prenv.h"
#include "mozilla/dom/indexedDB/IDBFactory.h" #include "mozilla/dom/indexedDB/IDBFactory.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h" #include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
@@ -932,9 +933,11 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mSerial = ++gSerialCounter; mSerial = ++gSerialCounter;
#ifdef DEBUG #ifdef DEBUG
printf("++DOMWINDOW == %d (%p) [serial = %d] [outer = %p]\n", gRefCnt, if (!PR_GetEnv("MOZ_QUIET")) {
static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)), printf("++DOMWINDOW == %d (%p) [serial = %d] [outer = %p]\n", gRefCnt,
gSerialCounter, static_cast<void*>(aOuterWindow)); static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)),
gSerialCounter, static_cast<void*>(aOuterWindow));
}
#endif #endif
#ifdef PR_LOGGING #ifdef PR_LOGGING
@@ -976,14 +979,16 @@ nsGlobalWindow::~nsGlobalWindow()
NS_IF_RELEASE(gEntropyCollector); NS_IF_RELEASE(gEntropyCollector);
} }
#ifdef DEBUG #ifdef DEBUG
nsCAutoString url; if (!PR_GetEnv("MOZ_QUIET")) {
if (mLastOpenedURI) { nsCAutoString url;
mLastOpenedURI->GetSpec(url); if (mLastOpenedURI) {
} mLastOpenedURI->GetSpec(url);
}
printf("--DOMWINDOW == %d (%p) [serial = %d] [outer = %p] [url = %s]\n", printf("--DOMWINDOW == %d (%p) [serial = %d] [outer = %p] [url = %s]\n",
gRefCnt, static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)), gRefCnt, static_cast<void*>(static_cast<nsIScriptGlobalObject*>(this)),
mSerial, static_cast<void*>(mOuterWindow.get()), url.get()); mSerial, static_cast<void*>(mOuterWindow.get()), url.get());
}
#endif #endif
#ifdef PR_LOGGING #ifdef PR_LOGGING