Bug 1162242 - Part 1: Remove instances of #ifdef PR_LOGGING. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Thu, 07 May 2015 09:43:35 -0700
changeset 242903 3c8a77e2a83faceccbf691f3d2d7d1840c10f989
parent 242902 914258721d1f01fb00e242b5b39ddd276c099daf
child 242904 917d62c82b1d94f1019f76ca21ef03106aedd693
push id12827
push userkwierso@gmail.com
push dateFri, 08 May 2015 17:41:26 +0000
treeherderfx-team@390f77eb9db6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1162242
milestone40.0a1
Bug 1162242 - Part 1: Remove instances of #ifdef PR_LOGGING. r=froydnj PR_LOGGING is now always defined, we can remove #ifdefs checking for it.
xpcom/components/nsComponentManager.cpp
xpcom/ds/TimeStamp_windows.cpp
xpcom/ds/nsObserverService.cpp
xpcom/io/nsInputStreamTee.cpp
xpcom/io/nsPipe3.cpp
xpcom/io/nsStorageStream.cpp
xpcom/threads/nsEventQueue.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsThreadPool.cpp
xpcom/threads/nsTimerImpl.h
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -1026,25 +1026,23 @@ nsComponentManagerImpl::FindFactory(cons
  * Returns an interface of type aIID off the singleton classobject.
  */
 NS_IMETHODIMP
 nsComponentManagerImpl::GetClassObject(const nsCID& aClass, const nsIID& aIID,
                                        void** aResult)
 {
   nsresult rv;
 
-#ifdef PR_LOGGING
   if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_DEBUG)) {
     char* buf = aClass.ToString();
     PR_LogPrint("nsComponentManager: GetClassObject(%s)", buf);
     if (buf) {
       free(buf);
     }
   }
-#endif
 
   PR_ASSERT(aResult != nullptr);
 
   nsCOMPtr<nsIFactory> factory = FindFactory(aClass);
   if (!factory) {
     return NS_ERROR_FACTORY_NOT_REGISTERED;
   }
 
@@ -1065,21 +1063,19 @@ nsComponentManagerImpl::GetClassObjectBy
   if (NS_WARN_IF(!aResult) ||
       NS_WARN_IF(!aContractID)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsresult rv;
 
 
-#ifdef PR_LOGGING
   if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_DEBUG)) {
     PR_LogPrint("nsComponentManager: GetClassObject(%s)", aContractID);
   }
-#endif
 
   nsCOMPtr<nsIFactory> factory = FindFactory(aContractID, strlen(aContractID));
   if (!factory) {
     return NS_ERROR_FACTORY_NOT_REGISTERED;
   }
 
   rv = factory->QueryInterface(aIID, aResult);
 
@@ -1148,27 +1144,25 @@ nsComponentManagerImpl::CreateInstance(c
       NS_ERROR("Factory did not return an object but returned success!");
       rv = NS_ERROR_SERVICE_NOT_FOUND;
     }
   } else {
     // Translate error values
     rv = NS_ERROR_FACTORY_NOT_REGISTERED;
   }
 
-#ifdef PR_LOGGING
   if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING)) {
     char* buf = aClass.ToString();
     PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
            ("nsComponentManager: CreateInstance(%s) %s", buf,
             NS_SUCCEEDED(rv) ? "succeeded" : "FAILED"));
     if (buf) {
       free(buf);
     }
   }
-#endif
 
   return rv;
 }
 
 /**
  * CreateInstanceByContractID()
  *
  * A variant of CreateInstance() that creates an instance of the object that
--- a/xpcom/ds/TimeStamp_windows.cpp
+++ b/xpcom/ds/TimeStamp_windows.cpp
@@ -15,17 +15,16 @@
 
 #include "nsCRT.h"
 #include "prlog.h"
 #include "prprf.h"
 #include <stdio.h>
 
 #include <intrin.h>
 
-#if defined(PR_LOGGING)
 // Log module for mozilla::TimeStamp for Windows logging...
 //
 // To enable logging (see prlog.h for full details):
 //
 //    set NSPR_LOG_MODULES=TimeStampWindows:5
 //    set NSPR_LOG_FILE=nspr.log
 //
 // this enables PR_LOG_DEBUG level information and places all output in
@@ -34,20 +33,17 @@ static PRLogModuleInfo*
 GetTimeStampLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("TimeStampWindows");
   }
   return sLog;
 }
-  #define LOG(x)  PR_LOG(GetTimeStampLog(), PR_LOG_DEBUG, x)
-#else
-  #define LOG(x)
-#endif /* PR_LOGGING */
+#define LOG(x)  PR_LOG(GetTimeStampLog(), PR_LOG_DEBUG, x)
 
 // Estimate of the smallest duration of time we can measure.
 static volatile ULONGLONG sResolution;
 static volatile ULONGLONG sResolutionSigDigs;
 static const double   kNsPerSecd  = 1000000000.0;
 static const LONGLONG kNsPerSec   = 1000000000;
 static const LONGLONG kNsPerMillisec = 1000000;
 
--- a/xpcom/ds/nsObserverService.cpp
+++ b/xpcom/ds/nsObserverService.cpp
@@ -13,17 +13,16 @@
 #include "nsThreadUtils.h"
 #include "nsEnumeratorUtils.h"
 #include "xpcpublic.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/Services.h"
 
 #define NOTIFY_GLOBAL_OBSERVERS
 
-#if defined(PR_LOGGING)
 // Log module for nsObserverService logging...
 //
 // To enable logging (see prlog.h for full details):
 //
 //    set NSPR_LOG_MODULES=ObserverService:5
 //    set NSPR_LOG_FILE=nspr.log
 //
 // this enables PR_LOG_DEBUG level information and places all output in
@@ -32,20 +31,17 @@ static PRLogModuleInfo*
 GetObserverServiceLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("ObserverService");
   }
   return sLog;
 }
-  #define LOG(x)  PR_LOG(GetObserverServiceLog(), PR_LOG_DEBUG, x)
-#else
-  #define LOG(x)
-#endif /* PR_LOGGING */
+#define LOG(x)  PR_LOG(GetObserverServiceLog(), PR_LOG_DEBUG, x)
 
 namespace mozilla {
 
 struct SuspectObserver
 {
   SuspectObserver(const char* aTopic, size_t aReferentCount)
     : topic(aTopic)
     , referentCount(aReferentCount)
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -17,30 +17,26 @@
 #include "nsIEventTarget.h"
 #include "nsThreadUtils.h"
 
 using namespace mozilla;
 
 #ifdef LOG
 #undef LOG
 #endif
-#ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetTeeLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("nsInputStreamTee");
   }
   return sLog;
 }
 #define LOG(args) PR_LOG(GetTeeLog(), PR_LOG_DEBUG, args)
-#else
-#define LOG(args)
-#endif
 
 class nsInputStreamTee final : public nsIInputStreamTee
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIINPUTSTREAMTEE
 
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -23,33 +23,29 @@
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 
 using namespace mozilla;
 
 #ifdef LOG
 #undef LOG
 #endif
-#if defined(PR_LOGGING)
 //
 // set NSPR_LOG_MODULES=nsPipe:5
 //
 static PRLogModuleInfo*
 GetPipeLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("nsPipe");
   }
   return sLog;
 }
 #define LOG(args) PR_LOG(GetPipeLog(), PR_LOG_DEBUG, args)
-#else
-#define LOG(args)
-#endif
 
 #define DEFAULT_SEGMENT_SIZE  4096
 #define DEFAULT_SEGMENT_COUNT 16
 
 class nsPipe;
 class nsPipeEvents;
 class nsPipeInputStream;
 class nsPipeOutputStream;
--- a/xpcom/io/nsStorageStream.cpp
+++ b/xpcom/io/nsStorageStream.cpp
@@ -25,17 +25,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 
 using mozilla::ipc::InputStreamParams;
 using mozilla::ipc::StringInputStreamParams;
 
-#if defined(PR_LOGGING)
 //
 // Log module for StorageStream logging...
 //
 // To enable logging (see prlog.h for full details):
 //
 //    set NSPR_LOG_MODULES=StorageStreamLog:5
 //    set NSPR_LOG_FILE=nspr.log
 //
@@ -46,17 +45,16 @@ static PRLogModuleInfo*
 GetStorageStreamLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("nsStorageStream");
   }
   return sLog;
 }
-#endif
 #ifdef LOG
 #undef LOG
 #endif
 #define LOG(args) PR_LOG(GetStorageStreamLog(), PR_LOG_DEBUG, args)
 
 nsStorageStream::nsStorageStream()
   : mSegmentedBuffer(0), mSegmentSize(0), mWriteInProgress(false),
     mLastSegmentNum(-1), mWriteCursor(0), mSegmentEnd(0), mLogicalLength(0)
--- a/xpcom/threads/nsEventQueue.cpp
+++ b/xpcom/threads/nsEventQueue.cpp
@@ -8,27 +8,25 @@
 #include "nsAutoPtr.h"
 #include "prlog.h"
 #include "nsThreadUtils.h"
 #include "prthread.h"
 #include "mozilla/ChaosMode.h"
 
 using namespace mozilla;
 
-#ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("nsEventQueue");
   }
   return sLog;
 }
-#endif
 #ifdef LOG
 #undef LOG
 #endif
 #define LOG(args) PR_LOG(GetLog(), PR_LOG_DEBUG, args)
 
 nsEventQueue::nsEventQueue()
   : mReentrantMonitor("nsEventQueue.mReentrantMonitor")
   , mHead(nullptr)
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -71,27 +71,25 @@
 
 #ifdef MOZ_TASK_TRACER
 #include "GeckoTaskTracer.h"
 using namespace mozilla::tasktracer;
 #endif
 
 using namespace mozilla;
 
-#ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetThreadLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("nsThread");
   }
   return sLog;
 }
-#endif
 #ifdef LOG
 #undef LOG
 #endif
 #define LOG(args) PR_LOG(GetThreadLog(), PR_LOG_DEBUG, args)
 
 NS_DECL_CI_INTERFACE_GETTER(nsThread)
 
 nsIThreadObserver* nsThread::sMainThreadObserver = nullptr;
--- a/xpcom/threads/nsThreadPool.cpp
+++ b/xpcom/threads/nsThreadPool.cpp
@@ -10,27 +10,25 @@
 #include "nsThread.h"
 #include "nsMemory.h"
 #include "nsAutoPtr.h"
 #include "prinrval.h"
 #include "prlog.h"
 
 using namespace mozilla;
 
-#ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetThreadPoolLog()
 {
   static PRLogModuleInfo* sLog;
   if (!sLog) {
     sLog = PR_NewLogModule("nsThreadPool");
   }
   return sLog;
 }
-#endif
 #ifdef LOG
 #undef LOG
 #endif
 #define LOG(args) PR_LOG(GetThreadPoolLog(), PR_LOG_DEBUG, args)
 
 // DESIGN:
 //  o  Allocate anonymous threads.
 //  o  Use nsThreadPool::Run as the main routine for each thread.
--- a/xpcom/threads/nsTimerImpl.h
+++ b/xpcom/threads/nsTimerImpl.h
@@ -16,22 +16,18 @@
 #include "prlog.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Attributes.h"
 
 #ifdef MOZ_TASK_TRACER
 #include "TracedTaskCommon.h"
 #endif
 
-#if defined(PR_LOGGING)
 extern PRLogModuleInfo* GetTimerLog();
 #define DEBUG_TIMERS 1
-#else
-#undef DEBUG_TIMERS
-#endif
 
 #define NS_TIMER_CID \
 { /* 5ff24248-1dd2-11b2-8427-fbab44f29bc8 */         \
      0x5ff24248,                                     \
      0x1dd2,                                         \
      0x11b2,                                         \
     {0x84, 0x27, 0xfb, 0xab, 0x44, 0xf2, 0x9b, 0xc8} \
 }