Backout 581822324d75
authorChris Jones <jones.chris.g@gmail.com>
Tue, 26 Jan 2010 20:08:28 -0600
changeset 46599 7cc30db4acb4a451e90898da95f8309f97a83f29
parent 46584 581822324d755d31e2324a1d4b646c32befd02de
child 46600 7a8fe3c399368ed9db2f266a4d86dd2a7c524243
push id14210
push userdougt@mozilla.com
push dateThu, 01 Jul 2010 06:28:42 +0000
treeherdermozilla-central@3aff97777291 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.3a1pre
backs out581822324d755d31e2324a1d4b646c32befd02de
Backout 581822324d75
ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc
+++ b/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc
@@ -76,32 +76,16 @@ bool
 IsProcessDead(pid_t process)
 {
   bool exited = false;
   // don't care if the process crashed, just if it exited
   base::DidProcessCrash(&exited, process);
   return exited;
 }
 
-bool
-WaitForProcessExitMaxSecs(pid_t process, int maxSecs)
-{
-  bool infiniteWait = (maxSecs < 0);
-  int status;
-  int nWaits = 0;
-
-  do {
-    HANDLE_EINTR(waitpid(process, &status, WNOHANG));
-  } while (!WIFEXITED(status) &&
-           (infiniteWait || nWaits++ < maxSecs) &&
-           0 == HANDLE_EINTR(sleep(1)));
-
-  return WIFEXITED(status);
-}
-
 
 class ChildReaper : public base::MessagePumpLibevent::SignalEvent,
                     public base::MessagePumpLibevent::SignalWatcher
 {
 public:
   explicit ChildReaper(pid_t process) : process_(process)
   {
   } 
@@ -137,26 +121,30 @@ protected:
     printf("TEST-UNEXPECTED-FAIL | process %d busy-waiting on | child process %d\n", getpid(), process_);
 
 
 
 #if 0
     HANDLE_EINTR(waitpid(process_, NULL, 0));
 #else
 
-    if (WaitForProcessExitMaxSecs(process_, 30)) {
-      printf("TEST-UNEXPECTED-FAIL | process %d done busy-waiting on | child process %d exited normally\n", getpid(), process_);
-      return;
-    }
+    const int maxWaits = 30;
+    int waits = 0;
+    while (!IsProcessDead(process_) && ++waits < maxWaits)
+      sleep(1);
 
-    printf("TEST-UNEXPECTED-FAIL | process %d wait on | child process %d timed out!\n", getpid(), process_);
-    // kill the child in such a way that breakpad is triggered
-    kill(process_, SIGSEGV);
-
-    WaitForProcessExitMaxSecs(process_, -1); // wait "forever"
+    if (waits < maxWaits) {
+      printf("TEST-UNEXPECTED-FAIL | process %d done busy-waiting on | child process %d\n", getpid(), process_);
+    }
+    else {
+      printf("TEST-UNEXPECTED-FAIL | process %d wait on | child process %d timed out!\n", getpid(), process_);
+      // kill the child in such a way that breakpad is triggered
+      kill(process_, SIGSEGV);
+      HANDLE_EINTR(waitpid(process_, NULL, 0));
+    }
 #endif
 
 
 
   }
 
   pid_t process_;
 
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1043,25 +1043,16 @@ OnChildProcessDumpRequested(void* aConte
                   getter_AddRefs(lf));
   pid = aClientInfo->pid();
 #else
   NS_NewNativeLocalFile(nsDependentCString(aFilePath->c_str()), PR_FALSE,
                         getter_AddRefs(lf));
   pid = aClientInfo->pid_;
 #endif
 
-
-
-#ifdef XP_LINUX
-  printf("TEST-UNEXPECTED-FAIL | got minidump at | %s\n", aFilePath->c_str());
-#endif
-
-
-
-
   // Get an .extra file with the same base name as the .dmp file
   nsCOMPtr<nsIFile> extraFile;
   nsresult rv = lf->Clone(getter_AddRefs(extraFile));
   if (NS_FAILED(rv))
     return;
 
   nsAutoString leafName;
   rv = extraFile->GetLeafName(leafName);
@@ -1072,24 +1063,16 @@ OnChildProcessDumpRequested(void* aConte
                    NS_LITERAL_STRING("extra"));
   rv = extraFile->SetLeafName(leafName);
   if (NS_FAILED(rv))
     return;
 
   // Now write out the annotations to it
   nsCOMPtr<nsIFileOutputStream> stream =
     do_CreateInstance("@mozilla.org/network/file-output-stream;1");
-
-
-
-  if (!stream)
-    return;
-
-
-
   rv = stream->Init(extraFile, -1, 0600, 0);
   if (NS_FAILED(rv))
     return;
   crashReporterAPIData_Hash->EnumerateRead(EnumerateChildAnnotations,
                                            stream.get());
   // Add CrashTime to extra data
   time_t crashTime = time(NULL);
   char crashTimeString[32];