Bug 1015497 - Enable FifoWatcher and its consumers on every Unix. r=froydnj, r=Alphan, r=jld, a=sledru
authorJan Beich <jbeich@tormail.org>
Thu, 29 May 2014 22:41:00 -0400
changeset 199376 719c6742188c47517a9712d5854eb7617b3db8a5
parent 199375 679f59ee1d57530787030b66923b1f0ef077c6f8
child 199377 6aa71900212a8bb8eb17887b050db5a7f3074f83
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, Alphan, jld, sledru
bugs1015497
milestone31.0a2
Bug 1015497 - Enable FifoWatcher and its consumers on every Unix. r=froydnj, r=Alphan, r=jld, a=sledru
xpcom/base/nsDumpUtils.cpp
xpcom/base/nsDumpUtils.h
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsStatusReporterManager.cpp
--- a/xpcom/base/nsDumpUtils.cpp
+++ b/xpcom/base/nsDumpUtils.cpp
@@ -8,17 +8,17 @@
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "prenv.h"
 #include <errno.h>
 #include "mozilla/Services.h"
 #include "nsIObserverService.h"
 #include "mozilla/ClearOnShutdown.h"
 
-#if defined(XP_LINUX) || defined(__FreeBSD__) || defined(XP_MACOSX) // {
+#ifdef XP_UNIX // {
 #include "mozilla/Preferences.h"
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
 using namespace mozilla;
 
@@ -413,17 +413,17 @@ void FifoWatcher::OnFileCanReadWithoutBl
         mFifoInfo[i].mCallback(inputStr);
         return;
       }
     }
   }
   LOG("Got unexpected value from fifo; ignoring it.");
 }
 
-#endif // XP_LINUX }
+#endif // XP_UNIX }
 
 // In Android case, this function will open a file named aFilename under
 // /data/local/tmp/"aFoldername".
 // Otherwise, it will open a file named aFilename under "NS_OS_TEMP_DIR".
 /* static */ nsresult
 nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
                           const nsACString& aFoldername)
 {
--- a/xpcom/base/nsDumpUtils.h
+++ b/xpcom/base/nsDumpUtils.h
@@ -23,17 +23,17 @@
 #include "android/log.h"
 #define LOG(...) __android_log_print(ANDROID_LOG_INFO, "Gecko:DumpUtils", ## __VA_ARGS__)
 #else
 #define LOG(...)
 #endif
 
 using namespace mozilla;
 
-#if defined(XP_LINUX) || defined(__FreeBSD__) || defined(XP_MACOSX) // {
+#ifdef XP_UNIX // {
 
 /**
  * Abstract base class for something which watches an fd and takes action when
  * we can read from it without blocking.
  */
 class FdWatcher : public MessageLoopForIO::Watcher
                 , public nsIObserver
 {
@@ -171,17 +171,17 @@ private:
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
 
   mozilla::Mutex mSignalInfoLock; // protects mSignalInfo
   SignalInfoArray mSignalInfo;
 };
 
-#endif // XP_LINUX }
+#endif // XP_UNIX }
 
 
 class nsDumpUtils
 {
 public:
   /**
    * This function creates a new unique file based on |aFilename| in a
    * world-readable temp directory. This is the system temp directory
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -23,17 +23,17 @@
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #else
 #include <unistd.h>
 #endif
 
-#if defined(XP_LINUX) || defined(__FreeBSD__) || defined(XP_MACOSX)
+#ifdef XP_UNIX
 #define MOZ_SUPPORTS_FIFO 1
 #endif
 
 #if defined(XP_LINUX) || defined(__FreeBSD__)
 #define MOZ_SUPPORTS_RT_SIGNALS 1
 #endif
 
 #if defined(MOZ_SUPPORTS_RT_SIGNALS)
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -13,17 +13,17 @@
 #include "nsMemoryReporterManager.h"
 #include "nsITimer.h"
 #include "nsThreadUtils.h"
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIObserverService.h"
 #include "nsIGlobalObject.h"
 #include "nsIXPConnect.h"
-#if defined(XP_LINUX) || defined(__FreeBSD__) || defined(XP_MACOSX)
+#if defined(XP_UNIX) || defined(MOZ_DMD)
 #include "nsMemoryInfoDumper.h"
 #endif
 #include "mozilla/Attributes.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/Services.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/PMemoryReportRequestParent.h" // for dom::MemoryReport
 
@@ -881,17 +881,17 @@ nsMemoryReporterManager::Init()
 #endif
 
   RegisterStrongReporter(new AtomTablesReporter());
 
 #ifdef MOZ_DMD
   RegisterStrongReporter(new mozilla::dmd::DMDReporter());
 #endif
 
-#if defined(XP_LINUX) || defined(__FreeBSD__) || defined(XP_MACOSX)
+#ifdef XP_UNIX
   nsMemoryInfoDumper::Initialize();
 #endif
 
   return NS_OK;
 }
 
 nsMemoryReporterManager::nsMemoryReporterManager()
   : mMutex("nsMemoryReporterManager::mMutex")
--- a/xpcom/base/nsStatusReporterManager.cpp
+++ b/xpcom/base/nsStatusReporterManager.cpp
@@ -16,23 +16,21 @@
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #else
 #include <unistd.h>
 #endif
 
-#if defined(XP_LINUX) || defined(__FreeBSD__)
+#ifdef XP_UNIX
 #define DO_STATUS_REPORT 1
-#else
-#define DO_STATUS_REPORT 0
 #endif
 
-#if DO_STATUS_REPORT // {
+#ifdef DO_STATUS_REPORT // {
 namespace {
 
 class DumpStatusInfoToTempDirRunnable : public nsRunnable
 {
 public:
   DumpStatusInfoToTempDirRunnable()
   {}
 
@@ -122,17 +120,17 @@ nsStatusReporterManager::~nsStatusReport
 }
 
 NS_IMETHODIMP
 nsStatusReporterManager::Init()
 {
   RegisterReporter(new NS_STATUS_REPORTER_NAME(StatusReporter));
   gStatusReportProgress = 1;
 
-#if DO_STATUS_REPORT
+#ifdef DO_STATUS_REPORT
   if (FifoWatcher::MaybeCreate()) {
     FifoWatcher* fw = FifoWatcher::GetSingleton();
     fw->RegisterCallback(NS_LITERAL_CSTRING("status report"),doStatusReport);
   }
 #endif
 
   return NS_OK;
 }