Backed out changeset bd71f9da9d7d (bug 990230) for build failures
authorEd Morley <emorley@mozilla.com>
Mon, 14 Apr 2014 18:09:53 +0100
changeset 196846 59bdd3a3758bfeb6abb34a0f0edfe487607abcf4
parent 196845 4e0a36f71558020b96bf6a49c1b1b60a9455ca94
child 196847 d6bbcef13750a6b7d16c38fa7f02dc9aa3a9585f
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)
bugs990230
milestone31.0a1
backs outbd71f9da9d7d1188d96dd9b4178d2b1e02be979f
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
Backed out changeset bd71f9da9d7d (bug 990230) for build failures
xpcom/base/nsDumpUtils.cpp
xpcom/base/nsDumpUtils.h
--- a/xpcom/base/nsDumpUtils.cpp
+++ b/xpcom/base/nsDumpUtils.cpp
@@ -113,94 +113,59 @@ SignalPipeWatcher::GetSingleton()
   if (!sSingleton) {
     sSingleton = new SignalPipeWatcher();
     sSingleton->Init();
     ClearOnShutdown(&sSingleton);
   }
   return sSingleton;
 }
 
-// static
-void
-SignalPipeWatcher::RegisterCallbackRunnable(const uint8_t& aSignal,
-                                            const PipeCallback& aCallback)
-{
-  MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
-  if (sSingleton) {
-    sSingleton->RegisterCallback(aSignal, aCallback);
-  }
-}
-
-void
-SignalPipeWatcher::RegisterCallback(uint8_t aSignal,
+/* static */ void
+SignalPipeWatcher::RegisterCallback(const uint8_t aSignal,
                                     PipeCallback aCallback)
 {
-  if (XRE_GetIOMessageLoop() != MessageLoopForIO::current()) {
-    XRE_GetIOMessageLoop()->PostTask(
-        FROM_HERE,
-        NewRunnableFunction(RegisterCallbackRunnable, aSignal, aCallback));
-    return;
-  }
-
-  for (SignalInfoArray::index_type i = 0; i < mSignalInfo.Length(); i++)
+  for (SignalInfoArray::index_type i = 0; 
+       i < SignalPipeWatcher::mSignalInfo.Length(); i++)
   {
-    if (mSignalInfo[i].mSignal == aSignal) {
+    if (SignalPipeWatcher::mSignalInfo[i].mSignal == aSignal) {
       LOG("Register Signal(%d) callback failed! (DUPLICATE)", aSignal);
       return;
     }
   }
-  SignalInfo signalInfo = { aSignal, aCallback };
-  mSignalInfo.AppendElement(signalInfo);
-  RegisterSignalHandler(signalInfo.mSignal);
+  SignalInfo aSignalInfo = { aSignal, aCallback };
+  SignalPipeWatcher::mSignalInfo.AppendElement(aSignalInfo);
+  SignalPipeWatcher::RegisterSignalHandler(aSignalInfo.mSignal);
 }
 
-// static
-void
-SignalPipeWatcher::RegisterSignalHandlerRunnable(const uint8_t& aSignal)
+/* static */ void
+SignalPipeWatcher::RegisterSignalHandler(const uint8_t aSignal)
 {
-  MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
-  if (sSingleton) {
-    sSingleton->RegisterSignalHandler(aSignal);
-  }
-}
-
-void
-SignalPipeWatcher::RegisterSignalHandler(uint8_t aSignal)
-{
-  if (XRE_GetIOMessageLoop() != MessageLoopForIO::current()) {
-    XRE_GetIOMessageLoop()->PostTask(
-        FROM_HERE,
-        NewRunnableFunction(RegisterSignalHandlerRunnable, aSignal));
-    return;
-  }
-
   struct sigaction action;
   memset(&action, 0, sizeof(action));
   sigemptyset(&action.sa_mask);
   action.sa_handler = DumpSignalHandler;
 
   if (aSignal) {
     if (sigaction(aSignal, &action, nullptr)) {
       LOG("SignalPipeWatcher failed to register sig %d.", aSignal);
     }
   } else {
-    for (SignalInfoArray::index_type i = 0; i < mSignalInfo.Length(); i++) {
-      if (sigaction(mSignalInfo[i].mSignal, &action, nullptr)) {
+    for (SignalInfoArray::index_type i = 0; i < SignalPipeWatcher::mSignalInfo.Length(); i++) {
+      if (sigaction(SignalPipeWatcher::mSignalInfo[i].mSignal, &action, nullptr)) {
         LOG("SignalPipeWatcher failed to register signal(%d) "
-            "dump signal handler.", mSignalInfo[i].mSignal);
+            "dump signal handler.",SignalPipeWatcher::mSignalInfo[i].mSignal);
       }
     }
   }
 }
 
 SignalPipeWatcher::~SignalPipeWatcher()
 {
-  if (sDumpPipeWriteFd != -1) {
-    StopWatching();
-  }
+  if (sDumpPipeWriteFd != -1)
+    SignalPipeWatcher::StopWatching();
 }
 
 int SignalPipeWatcher::OpenFd()
 {
   MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
 
   // Create a pipe.  When we receive a signal in our signal handler, we'll
   // write the signum to the write-end of this pipe.
@@ -212,17 +177,17 @@ int SignalPipeWatcher::OpenFd()
 
   // Close this pipe on calls to exec().
   fcntl(pipeFds[0], F_SETFD, FD_CLOEXEC);
   fcntl(pipeFds[1], F_SETFD, FD_CLOEXEC);
 
   int readFd = pipeFds[0];
   sDumpPipeWriteFd = pipeFds[1];
 
-  RegisterSignalHandler();
+  SignalPipeWatcher::RegisterSignalHandler();
   return readFd;
 }
 
 void SignalPipeWatcher::StopWatching()
 {
   MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
 
   // Close sDumpPipeWriteFd /after/ setting the fd to -1.
@@ -245,19 +210,19 @@ void SignalPipeWatcher::OnFileCanReadWit
   uint8_t signum;
   ssize_t numReceived = read(aFd, &signum, sizeof(signum));
   if (numReceived != sizeof(signum)) {
     LOG("Error reading from buffer in "
         "SignalPipeWatcher::OnFileCanReadWithoutBlocking.");
     return;
   }
 
-  for (SignalInfoArray::index_type i = 0; i < mSignalInfo.Length(); i++) {
-    if(signum == mSignalInfo[i].mSignal) {
-      mSignalInfo[i].mCallback(signum);
+  for (SignalInfoArray::index_type i = 0; i < SignalPipeWatcher::mSignalInfo.Length(); i++) {
+    if(signum == SignalPipeWatcher::mSignalInfo[i].mSignal) {
+      SignalPipeWatcher::mSignalInfo[i].mCallback(signum);
       return;
     }
   }
   LOG("SignalPipeWatcher got unexpected signum.");
 }
 
 StaticRefPtr<FifoWatcher> FifoWatcher::sSingleton;
 
@@ -287,52 +252,35 @@ FifoWatcher::MaybeCreate()
   }
 
   if (!Preferences::GetBool("memory_info_dumper.watch_fifo.enabled", false)) {
     LOG("Fifo watcher disabled via pref.");
     return false;
   }
 
   // The FifoWatcher is held alive by the observer service.
-  if (!sSingleton) {
-    GetSingleton();
+  if (!FifoWatcher::sSingleton) {
+    FifoWatcher::GetSingleton();
   }
   return true;
 }
 
-//static
 void
-FifoWatcher::RegisterCallbackRunnable(const nsCString& aCommand,
-                                      const FifoCallback& aCallback)
+FifoWatcher::RegisterCallback(const nsCString& aCommand,FifoCallback aCallback)
 {
-  MOZ_ASSERT(XRE_GetIOMessageLoop() == MessageLoopForIO::current());
-  if (sSingleton) {
-    sSingleton->RegisterCallback(aCommand, aCallback);
-  }
-}
-
-void
-FifoWatcher::RegisterCallback(const nsCString& aCommand, FifoCallback aCallback)
-{
-  if (XRE_GetIOMessageLoop() != MessageLoopForIO::current()) {
-    XRE_GetIOMessageLoop()->PostTask(
-        FROM_HERE,
-        NewRunnableFunction(RegisterCallbackRunnable, aCommand, aCallback));
-    return;
-  }
-
-  for (FifoInfoArray::index_type i = 0; i < mFifoInfo.Length(); i++)
+  for (FifoInfoArray::index_type i = 0;
+       i < FifoWatcher::mFifoInfo.Length(); i++)
   {
-    if (mFifoInfo[i].mCommand.Equals(aCommand)) {
+    if (FifoWatcher::mFifoInfo[i].mCommand.Equals(aCommand)) {
       LOG("Register command(%s) callback failed! (DUPLICATE)", aCommand.get());
       return;
     }
   }
   FifoInfo aFifoInfo = { aCommand, aCallback };
-  mFifoInfo.AppendElement(aFifoInfo);
+  FifoWatcher::mFifoInfo.AppendElement(aFifoInfo);
 }
 
 FifoWatcher::~FifoWatcher()
 {
 }
 
 int FifoWatcher::OpenFd()
 {
@@ -439,20 +387,20 @@ void FifoWatcher::OnFileCanReadWithoutBl
   nsAutoCString inputStr;
   inputStr.Append(buf, nread);
 
   // Trimming whitespace is important because if you do
   //   |echo "foo" >> debug_info_trigger|,
   // it'll actually write "foo\n" to the fifo.
   inputStr.Trim("\b\t\r\n");
 
-  for (FifoInfoArray::index_type i = 0; i < mFifoInfo.Length(); i++) {
-    const nsCString commandStr = mFifoInfo[i].mCommand;
+  for (FifoInfoArray::index_type i = 0; i < FifoWatcher::mFifoInfo.Length(); i++) {
+    const nsCString commandStr = FifoWatcher::mFifoInfo[i].mCommand;
     if(inputStr == commandStr.get()) {
-      mFifoInfo[i].mCallback(inputStr);
+      FifoWatcher::mFifoInfo[i].mCallback(inputStr);
       return;
     }
   }
   LOG("Got unexpected value from fifo; ignoring it.");
 }
 
 #endif // XP_LINUX }
 
--- a/xpcom/base/nsDumpUtils.h
+++ b/xpcom/base/nsDumpUtils.h
@@ -123,35 +123,34 @@ private:
   nsAutoCString mDirPath;
 
   static StaticRefPtr<FifoWatcher> sSingleton;
 
   FifoWatcher(nsCString aPath)
     : mDirPath(aPath)
   {}
 
-  static void RegisterCallbackRunnable(const nsCString& aCommand, const FifoCallback& aCallback);
   FifoInfoArray mFifoInfo;
 };
 
 typedef void (* PipeCallback)(const uint8_t recvSig);
 struct SignalInfo {
   uint8_t mSignal;
   PipeCallback mCallback;
 };
 typedef nsTArray<SignalInfo> SignalInfoArray;
 
 class SignalPipeWatcher : public FdWatcher
 {
 public:
   static SignalPipeWatcher* GetSingleton();
 
-  void RegisterCallback(uint8_t aSignal, PipeCallback aCallback);
+  void RegisterCallback(const uint8_t aSignal, PipeCallback aCallback);
 
-  void RegisterSignalHandler(uint8_t aSignal = 0);
+  void RegisterSignalHandler(const uint8_t aSignal = 0);
 
   virtual ~SignalPipeWatcher();
 
   virtual int OpenFd();
 
   virtual void StopWatching();
 
   virtual void OnFileCanReadWithoutBlocking(int aFd);
@@ -159,19 +158,16 @@ public:
 private:
   static StaticRefPtr<SignalPipeWatcher> sSingleton;
 
   SignalPipeWatcher()
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
 
-  static void RegisterCallbackRunnable(const uint8_t& aSignal, const PipeCallback& aCallback);
-  static void RegisterSignalHandlerRunnable(const uint8_t& aSignal);
-
   SignalInfoArray mSignalInfo;
 };
 
 #endif // XP_LINUX }
 
 
 class nsDumpUtils
 {