From d94083f05ba8472557892fd50694f6aa72a0622f Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Thu, 7 May 2015 10:14:55 -0700 Subject: [PATCH] Bug 1162309 - Part 1: Remove instances of #ifdef PR_LOGGING in uriloader. r=froydnj PR_LOGGING is now always defined, we can remove #ifdefs checking for it. --- uriloader/base/nsDocLoader.cpp | 9 +-------- uriloader/base/nsURILoader.cpp | 10 ---------- uriloader/base/nsURILoader.h | 2 -- uriloader/exthandler/nsExternalHelperAppService.cpp | 8 -------- uriloader/exthandler/nsExternalHelperAppService.h | 2 -- uriloader/prefetch/OfflineCacheUpdateChild.cpp | 4 ---- uriloader/prefetch/OfflineCacheUpdateGlue.cpp | 4 ---- uriloader/prefetch/OfflineCacheUpdateParent.cpp | 2 -- uriloader/prefetch/nsOfflineCacheUpdate.cpp | 8 -------- uriloader/prefetch/nsOfflineCacheUpdateService.cpp | 4 ---- uriloader/prefetch/nsPrefetchService.cpp | 8 -------- 11 files changed, 1 insertion(+), 60 deletions(-) diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 3e82582a7a01..6459dc05c173 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -37,7 +37,6 @@ static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID); -#if defined(PR_LOGGING) // // Log module for nsIDocumentLoader logging... // @@ -50,7 +49,6 @@ static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID); // the file nspr.log // PRLogModuleInfo* gDocLoaderLog = nullptr; -#endif /* PR_LOGGING */ #if defined(DEBUG) @@ -105,11 +103,9 @@ nsDocLoader::nsDocLoader() mDontFlushLayout(false), mIsFlushingLayout(false) { -#if defined(PR_LOGGING) if (nullptr == gDocLoaderLog) { gDocLoaderLog = PR_NewLogModule("DocLoader"); } -#endif /* PR_LOGGING */ static const PLDHashTableOps hash_table_ops = { @@ -402,7 +398,6 @@ nsDocLoader::OnStartRequest(nsIRequest *request, nsISupports *aCtxt) { // called each time a request is added to the group. -#ifdef PR_LOGGING if (PR_LOG_TEST(gDocLoaderLog, PR_LOG_DEBUG)) { nsAutoCString name; request->GetName(name); @@ -417,7 +412,7 @@ nsDocLoader::OnStartRequest(nsIRequest *request, nsISupports *aCtxt) (mIsLoadingDocument ? "true" : "false"), count)); } -#endif /* PR_LOGGING */ + bool bJustStartedLoading = false; nsLoadFlags loadFlags = 0; @@ -483,7 +478,6 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest, { nsresult rv = NS_OK; -#ifdef PR_LOGGING if (PR_LOG_TEST(gDocLoaderLog, PR_LOG_DEBUG)) { nsAutoCString name; aRequest->GetName(name); @@ -498,7 +492,6 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest, aStatus, (mIsLoadingDocument ? "true" : "false"), count)); } -#endif bool bFireTransferring = false; diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index 85fbbe225fc3..d0dde7164664 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -51,9 +51,7 @@ #include "mozilla/Attributes.h" #include "mozilla/Preferences.h" -#ifdef PR_LOGGING PRLogModuleInfo* nsURILoader::mLog = nullptr; -#endif #define LOG(args) PR_LOG(nsURILoader::mLog, PR_LOG_DEBUG, args) #define LOG_ERROR(args) PR_LOG(nsURILoader::mLog, PR_LOG_ERROR, args) @@ -475,11 +473,9 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports * LOG((" Content handler failed. Aborting load")); request->Cancel(rv); } -#ifdef PR_LOGGING else { LOG((" Content handler taking over load")); } -#endif return rv; } @@ -759,11 +755,9 @@ nsDocumentOpenInfo::TryContentListener(nsIURIContentListener* aListener, nsURILoader::nsURILoader() { -#ifdef PR_LOGGING if (!mLog) { mLog = PR_NewLogModule("URILoader"); } -#endif } nsURILoader::~nsURILoader() @@ -807,7 +801,6 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel, { NS_ENSURE_ARG_POINTER(channel); -#ifdef PR_LOGGING if (LOG_ENABLED()) { nsCOMPtr uri; channel->GetURI(getter_AddRefs(uri)); @@ -815,7 +808,6 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel, uri->GetAsciiSpec(spec); LOG(("nsURILoader::OpenURI for %s", spec.get())); } -#endif nsCOMPtr loader; nsresult rv = OpenChannel(channel, @@ -854,7 +846,6 @@ nsresult nsURILoader::OpenChannel(nsIChannel* channel, NS_ASSERTION(channel, "Trying to open a null channel!"); NS_ASSERTION(aWindowContext, "Window context must not be null"); -#ifdef PR_LOGGING if (LOG_ENABLED()) { nsCOMPtr uri; channel->GetURI(getter_AddRefs(uri)); @@ -862,7 +853,6 @@ nsresult nsURILoader::OpenChannel(nsIChannel* channel, uri->GetAsciiSpec(spec); LOG(("nsURILoader::OpenChannel for %s", spec.get())); } -#endif // Let the window context's uriListener know that the open is starting. This // gives that window a chance to abort the load process. diff --git a/uriloader/base/nsURILoader.h b/uriloader/base/nsURILoader.h index 79263b526144..7b9de35aeb60 100644 --- a/uriloader/base/nsURILoader.h +++ b/uriloader/base/nsURILoader.h @@ -48,12 +48,10 @@ protected: */ nsCOMArray m_listeners; -#ifdef PR_LOGGING /** * NSPR logging. The module is called "URILoader" */ static PRLogModuleInfo* mLog; -#endif friend class nsDocumentOpenInfo; }; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 7c601fc36470..a898b95af11a 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -122,9 +122,7 @@ enum { , NS_FOLDER_VALUE_CUSTOM = 2 }; -#ifdef PR_LOGGING PRLogModuleInfo* nsExternalHelperAppService::mLog = nullptr; -#endif // Using level 3 here because the OSHelperAppServices use a log level // of PR_LOG_DEBUG (4), and we want less detailed output here @@ -591,13 +589,11 @@ nsresult nsExternalHelperAppService::Init() if (!obs) return NS_ERROR_FAILURE; -#ifdef PR_LOGGING if (!mLog) { mLog = PR_NewLogModule("HelperAppService"); if (!mLog) return NS_ERROR_OUT_OF_MEMORY; } -#endif nsresult rv = obs->AddObserver(this, "profile-before-change", true); NS_ENSURE_SUCCESS(rv, rv); @@ -1612,12 +1608,10 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo nsresult transferError = rv; rv = CreateFailedTransfer(aChannel && NS_UsePrivateBrowsing(aChannel)); -#ifdef PR_LOGGING if (NS_FAILED(rv)) { LOG(("Failed to create transfer to report failure." "Will fallback to prompter!")); } -#endif mCanceled = true; request->Cancel(transferError); @@ -2637,7 +2631,6 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromTypeAndExtension(const nsACStri (*_retval)->SetPrimaryExtension(aFileExt); } -#ifdef PR_LOGGING if (LOG_ENABLED()) { nsAutoCString type; (*_retval)->GetMIMEType(type); @@ -2646,7 +2639,6 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromTypeAndExtension(const nsACStri (*_retval)->GetPrimaryExtension(ext); LOG(("MIME Info Summary: Type '%s', Primary Ext '%s'\n", type.get(), ext.get())); } -#endif return NS_OK; } diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 511daac8c156..f182929bde3e 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -141,7 +141,6 @@ protected: bool GetTypeFromExtras(const nsACString& aExtension, nsACString& aMIMEType); -#ifdef PR_LOGGING /** * NSPR Logging Module. Usage: set NSPR_LOG_MODULES=HelperAppService:level, * where level should be 2 for errors, 3 for debug messages from the cross- @@ -149,7 +148,6 @@ protected: */ static PRLogModuleInfo* mLog; -#endif // friend, so that it can access the nspr log module. friend class nsExternalAppHandler; diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.cpp b/uriloader/prefetch/OfflineCacheUpdateChild.cpp index d94b242f9117..041c96146001 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -36,7 +36,6 @@ using namespace mozilla::net; using mozilla::dom::TabChild; using mozilla::dom::ContentChild; -#if defined(PR_LOGGING) // // To enable logging (see prlog.h for full details): // @@ -47,7 +46,6 @@ using mozilla::dom::ContentChild; // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; -#endif #undef LOG #define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) @@ -153,7 +151,6 @@ OfflineCacheUpdateChild::AssociateDocument(nsIDOMDocument *aDocument, NS_ENSURE_SUCCESS(rv, rv); if (!existingCache) { -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString clientID; if (aApplicationCache) { @@ -162,7 +159,6 @@ OfflineCacheUpdateChild::AssociateDocument(nsIDOMDocument *aDocument, LOG(("Update %p: associating app cache %s to document %p", this, clientID.get(), aDocument)); } -#endif rv = container->SetApplicationCache(aApplicationCache); NS_ENSURE_SUCCESS(rv, rv); diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp index bfcb253931a4..b8b0d2ad50dc 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp @@ -14,7 +14,6 @@ #include "nsIDocument.h" #include "prlog.h" -#if defined(PR_LOGGING) // // To enable logging (see prlog.h for full details): // @@ -25,7 +24,6 @@ // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; -#endif #undef LOG #define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) @@ -203,7 +201,6 @@ OfflineCacheUpdateGlue::ApplicationCacheAvailable(nsIApplicationCache *aApplicat NS_ENSURE_SUCCESS(rv, rv); if (!existingCache) { -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString clientID; if (aApplicationCache) { @@ -212,7 +209,6 @@ OfflineCacheUpdateGlue::ApplicationCacheAvailable(nsIApplicationCache *aApplicat LOG(("Update %p: associating app cache %s to document %p", this, clientID.get(), mDocument.get())); } -#endif rv = container->SetApplicationCache(aApplicationCache); NS_ENSURE_SUCCESS(rv, rv); diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.cpp b/uriloader/prefetch/OfflineCacheUpdateParent.cpp index ea4e58cc9770..e20e30aabe42 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp @@ -17,7 +17,6 @@ using namespace mozilla::ipc; using mozilla::dom::TabParent; -#if defined(PR_LOGGING) // // To enable logging (see prlog.h for full details): // @@ -28,7 +27,6 @@ using mozilla::dom::TabParent; // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; -#endif #undef LOG #define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index b41b6174c0a4..6300d59e1581 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -51,7 +51,6 @@ static const uint32_t kParallelLoadLimit = 15; // Quota for offline apps when preloading static const int32_t kCustomProfileQuota = 512000; -#if defined(PR_LOGGING) // // To enable logging (see prlog.h for full details): // @@ -62,7 +61,6 @@ static const int32_t kCustomProfileQuota = 512000; // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; -#endif #undef LOG #define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) @@ -343,13 +341,11 @@ nsOfflineCacheUpdateItem::~nsOfflineCacheUpdateItem() nsresult nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate) { -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString spec; mURI->GetSpec(spec); LOG(("%p: Opening channel for %s", this, spec.get())); } -#endif if (mUpdate) { // Holding a reference to the update means this item is already @@ -466,14 +462,12 @@ nsOfflineCacheUpdateItem::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus) { -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString spec; mURI->GetSpec(spec); LOG(("%p: Done fetching offline item %s [status=%x]\n", this, spec.get(), aStatus)); } -#endif if (mBytesRead == 0 && aStatus == NS_OK) { // we didn't need to read (because LOAD_ONLY_IF_MODIFIED was @@ -1879,13 +1873,11 @@ nsOfflineCacheUpdate::ProcessNextURI() return NS_OK; } -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString spec; runItem->mURI->GetSpec(spec); LOG(("%p: Opening channel for %s", this, spec.get())); } -#endif ++mItemsInProgress; NotifyState(nsIOfflineCacheUpdateObserver::STATE_ITEMSTARTED); diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index 9f4b6f9d2b3d..a9b181ddee46 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -70,7 +70,6 @@ typedef mozilla::docshell::OfflineCacheUpdateParent OfflineCacheUpdateParent; typedef mozilla::docshell::OfflineCacheUpdateChild OfflineCacheUpdateChild; typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue; -#if defined(PR_LOGGING) // // To enable logging (see prlog.h for full details): // @@ -81,7 +80,6 @@ typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue; // the file offlineupdate.log // PRLogModuleInfo *gOfflineCacheUpdateLog; -#endif #undef LOG #define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) @@ -295,10 +293,8 @@ nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService() nsresult nsOfflineCacheUpdateService::Init() { -#if defined(PR_LOGGING) if (!gOfflineCacheUpdateLog) gOfflineCacheUpdateLog = PR_NewLogModule("nsOfflineCacheUpdate"); -#endif // Observe xpcom-shutdown event nsCOMPtr observerService = diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 5c204ef83aac..ceb399e57d3a 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -32,7 +32,6 @@ using namespace mozilla; -#if defined(PR_LOGGING) // // To enable logging (see prlog.h for full details): // @@ -43,7 +42,6 @@ using namespace mozilla; // the file http.log // static PRLogModuleInfo *gPrefetchLog; -#endif #undef LOG #define LOG(args) PR_LOG(gPrefetchLog, 4, args) @@ -410,10 +408,8 @@ nsPrefetchService::~nsPrefetchService() nsresult nsPrefetchService::Init() { -#if defined(PR_LOGGING) if (!gPrefetchLog) gPrefetchLog = PR_NewLogModule("nsPrefetch"); -#endif nsresult rv; @@ -449,13 +445,11 @@ nsPrefetchService::ProcessNextURI() if (NS_FAILED(rv)) break; -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString spec; mCurrentNode->mURI->GetSpec(spec); LOG(("ProcessNextURI [%s]\n", spec.get())); } -#endif // // if opening the channel fails, then just skip to the next uri @@ -636,13 +630,11 @@ nsPrefetchService::Prefetch(nsIURI *aURI, NS_ENSURE_ARG_POINTER(aURI); NS_ENSURE_ARG_POINTER(aReferrerURI); -#if defined(PR_LOGGING) if (LOG_ENABLED()) { nsAutoCString spec; aURI->GetSpec(spec); LOG(("PrefetchURI [%s]\n", spec.get())); } -#endif if (mDisabled) { LOG(("rejected: prefetch service is disabled\n"));