From 98f171e09f11c9ec97262d3dab5d40c9d95ba9c6 Mon Sep 17 00:00:00 2001 From: sajitk Date: Fri, 29 Jan 2016 16:30:00 -0800 Subject: [PATCH] Bug 1219482: Replace PRLogModuleInfo with LazyLogModule in uriloader subdirectory.r=erahm --- uriloader/base/nsDocLoader.cpp | 6 +----- uriloader/base/nsURILoader.cpp | 5 +---- uriloader/base/nsURILoader.h | 4 ++-- uriloader/exthandler/nsExternalHelperAppService.cpp | 8 +------- uriloader/exthandler/nsExternalHelperAppService.h | 2 +- uriloader/prefetch/OfflineCacheUpdateChild.cpp | 2 +- uriloader/prefetch/OfflineCacheUpdateGlue.cpp | 4 ++-- uriloader/prefetch/OfflineCacheUpdateParent.cpp | 2 +- uriloader/prefetch/nsOfflineCacheUpdate.cpp | 2 +- uriloader/prefetch/nsOfflineCacheUpdateService.cpp | 5 +---- uriloader/prefetch/nsPrefetchService.cpp | 7 ++----- 11 files changed, 14 insertions(+), 33 deletions(-) diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 239aa38a399f..8dd70e47e0aa 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -50,7 +50,7 @@ static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID); // this enables LogLevel::Debug level information and places all output in // the file nspr.log // -PRLogModuleInfo* gDocLoaderLog = nullptr; +mozilla::LazyLogModule gDocLoaderLog("DocLoader"); #if defined(DEBUG) @@ -115,10 +115,6 @@ nsDocLoader::nsDocLoader() mDontFlushLayout(false), mIsFlushingLayout(false) { - if (nullptr == gDocLoaderLog) { - gDocLoaderLog = PR_NewLogModule("DocLoader"); - } - ClearInternalProgress(); MOZ_LOG(gDocLoaderLog, LogLevel::Debug, diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index 2ce1fa82b91d..7c1da6e99e7a 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -50,7 +50,7 @@ #include "mozilla/Attributes.h" #include "mozilla/Preferences.h" -PRLogModuleInfo* nsURILoader::mLog = nullptr; +mozilla::LazyLogModule nsURILoader::mLog("URILoader"); #define LOG(args) MOZ_LOG(nsURILoader::mLog, mozilla::LogLevel::Debug, args) #define LOG_ERROR(args) MOZ_LOG(nsURILoader::mLog, mozilla::LogLevel::Error, args) @@ -753,9 +753,6 @@ nsDocumentOpenInfo::TryContentListener(nsIURIContentListener* aListener, nsURILoader::nsURILoader() { - if (!mLog) { - mLog = PR_NewLogModule("URILoader"); - } } nsURILoader::~nsURILoader() diff --git a/uriloader/base/nsURILoader.h b/uriloader/base/nsURILoader.h index c909300078a9..1921d2e881c8 100644 --- a/uriloader/base/nsURILoader.h +++ b/uriloader/base/nsURILoader.h @@ -49,9 +49,9 @@ protected: nsCOMArray m_listeners; /** - * NSPR logging. The module is called "URILoader" + * Logging. The module is called "URILoader" */ - static PRLogModuleInfo* mLog; + static mozilla::LazyLogModule mLog; friend class nsDocumentOpenInfo; }; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index b46fd9dcea18..b8306c03af85 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -122,7 +122,7 @@ enum { , NS_FOLDER_VALUE_CUSTOM = 2 }; -PRLogModuleInfo* nsExternalHelperAppService::mLog = nullptr; +LazyLogModule nsExternalHelperAppService::mLog("HelperAppService"); // Using level 3 here because the OSHelperAppServices use a log level // of LogLevel::Debug (4), and we want less detailed output here @@ -661,12 +661,6 @@ nsresult nsExternalHelperAppService::Init() if (!obs) return NS_ERROR_FAILURE; - if (!mLog) { - mLog = PR_NewLogModule("HelperAppService"); - if (!mLog) - return NS_ERROR_OUT_OF_MEMORY; - } - nsresult rv = obs->AddObserver(this, "profile-before-change", true); NS_ENSURE_SUCCESS(rv, rv); return obs->AddObserver(this, "last-pb-context-exited", true); diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index fba2fa8956a2..30001fda728f 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -146,7 +146,7 @@ protected: * where level should be 2 for errors, 3 for debug messages from the cross- * platform nsExternalHelperAppService, and 4 for os-specific debug messages. */ - static PRLogModuleInfo* mLog; + static mozilla::LazyLogModule mLog; // 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 972e842983bc..1cef80b18439 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -46,7 +46,7 @@ using mozilla::dom::ContentChild; // this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // -extern PRLogModuleInfo *gOfflineCacheUpdateLog; +extern mozilla::LazyLogModule gOfflineCacheUpdateLog; #undef LOG #define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp index 3aa89bca4831..f4d889bb558f 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp @@ -15,7 +15,7 @@ #include "mozilla/Logging.h" // -// To enable logging (see prlog.h for full details): +// To enable logging (see mozilla/Logging.h for full details): // // set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5 // set NSPR_LOG_FILE=offlineupdate.log @@ -23,7 +23,7 @@ // this enables LogLevel::Info level information and places all output in // the file offlineupdate.log // -extern PRLogModuleInfo *gOfflineCacheUpdateLog; +extern mozilla::LazyLogModule gOfflineCacheUpdateLog; #undef LOG #define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.cpp b/uriloader/prefetch/OfflineCacheUpdateParent.cpp index 64c6416f37b8..f61a57663499 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp @@ -31,7 +31,7 @@ using mozilla::dom::TabParent; // this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // -extern PRLogModuleInfo *gOfflineCacheUpdateLog; +extern mozilla::LazyLogModule gOfflineCacheUpdateLog; #undef LOG #define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index f5c24ce2f500..96d960842a6e 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -61,7 +61,7 @@ static const int32_t kCustomProfileQuota = 512000; // this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // -extern PRLogModuleInfo *gOfflineCacheUpdateLog; +extern LazyLogModule gOfflineCacheUpdateLog; #undef LOG #define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index f26fb136aa03..a52649950e0f 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -78,7 +78,7 @@ typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue; // this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // -PRLogModuleInfo *gOfflineCacheUpdateLog; +LazyLogModule gOfflineCacheUpdateLog("nsOfflineCacheUpdate"); #undef LOG #define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) @@ -262,9 +262,6 @@ nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService() nsresult nsOfflineCacheUpdateService::Init() { - if (!gOfflineCacheUpdateLog) - gOfflineCacheUpdateLog = PR_NewLogModule("nsOfflineCacheUpdate"); - // Observe xpcom-shutdown event nsCOMPtr observerService = mozilla::services::GetObserverService(); diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 97120d0e4262..448821cc807e 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -36,7 +36,7 @@ using namespace mozilla; // -// To enable logging (see prlog.h for full details): +// To enable logging (see mozilla/Logging.h for full details): // // set NSPR_LOG_MODULES=nsPrefetch:5 // set NSPR_LOG_FILE=prefetch.log @@ -44,7 +44,7 @@ using namespace mozilla; // this enables LogLevel::Debug level information and places all output in // the file http.log // -static PRLogModuleInfo *gPrefetchLog; +static LazyLogModule gPrefetchLog("nsPrefetch"); #undef LOG #define LOG(args) MOZ_LOG(gPrefetchLog, mozilla::LogLevel::Debug, args) @@ -343,9 +343,6 @@ nsPrefetchService::~nsPrefetchService() nsresult nsPrefetchService::Init() { - if (!gPrefetchLog) - gPrefetchLog = PR_NewLogModule("nsPrefetch"); - nsresult rv; // read prefs and hook up pref observer