Bug 806618 - followup - remove PR_NewLogModule static initializer in nsNativeComponentLoader.cpp; r=ehsan
authorNathan Froyd <froydnj@mozilla.com>
Wed, 07 Nov 2012 16:20:25 -0500
changeset 112696 fdcb6474f4b439026e87cc597e6ad84119f30c77
parent 112695 77378c09bbb526d7091d8f98c6c2f6a8901ecde5
child 112697 7f38df5f2448685a1e9c0c1a229b3badd552ae9b
push id23835
push userryanvm@gmail.com
push dateFri, 09 Nov 2012 00:52:02 +0000
treeherdermozilla-central@27ae6c86237f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs806618
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 806618 - followup - remove PR_NewLogModule static initializer in nsNativeComponentLoader.cpp; r=ehsan
xpcom/components/nsNativeComponentLoader.cpp
--- a/xpcom/components/nsNativeComponentLoader.cpp
+++ b/xpcom/components/nsNativeComponentLoader.cpp
@@ -47,24 +47,30 @@
 #endif
 
 #ifdef DEBUG
 #define IMPLEMENT_BREAK_AFTER_LOAD
 #endif
 
 using namespace mozilla;
 
-static PRLogModuleInfo *nsNativeModuleLoaderLog =
-    PR_NewLogModule("nsNativeModuleLoader");
+static PRLogModuleInfo *
+GetNativeModuleLoaderLog()
+{
+    static PRLogModuleInfo *sLog;
+    if (!sLog)
+        sLog = PR_NewLogModule("nsNativeModuleLoader");
+    return sLog;
+}
 
 bool gInXPCOMLoadOnMainThread = false;
 
-#define LOG(level, args) PR_LOG(nsNativeModuleLoaderLog, level, args)
+#define LOG(level, args) PR_LOG(GetNativeModuleLoaderLog(), level, args)
 
-NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader, 
+NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader,
                          mozilla::ModuleLoader)
 
 NS_IMPL_ADDREF_USING_AGGREGATOR(nsNativeModuleLoader,
                                 nsComponentManagerImpl::gComponentManager)
 NS_IMPL_RELEASE_USING_AGGREGATOR(nsNativeModuleLoader,
                                  nsComponentManagerImpl::gComponentManager)
 
 nsresult
@@ -199,17 +205,17 @@ nsNativeModuleLoader::ReleaserFunc(nsIHa
     aLoadData.module = nullptr;
     return PL_DHASH_NEXT;
 }
 
 PLDHashOperator
 nsNativeModuleLoader::UnloaderFunc(nsIHashable* aHashedFile,
                                    NativeLoadData& aLoadData, void*)
 {
-    if (PR_LOG_TEST(nsNativeModuleLoaderLog, PR_LOG_DEBUG)) {
+    if (PR_LOG_TEST(GetNativeModuleLoaderLog(), PR_LOG_DEBUG)) {
         nsCOMPtr<nsIFile> file(do_QueryInterface(aHashedFile));
 
         nsAutoCString filePath;
         file->GetNativePath(filePath);
 
         LOG(PR_LOG_DEBUG,
             ("nsNativeModuleLoader::UnloaderFunc(\"%s\")", filePath.get()));
     }