Bug 540967 - "missing output line for total leaks" because the parent process isn't waiting for the child process to clean up/write leak logs, r=cjones
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 22 Jan 2010 10:21:33 -0500
changeset 37479 38e86af9675796a35fa8e9cc42b5aee339debe65
parent 37478 43ebc4244f7d38e4ce2c4cccd77b3d5fab1772c3
child 37480 b8a1a64e36e0d6c72ddb1f0cf6bc3d4bbaef3f33
push id11325
push userbsmedberg@mozilla.com
push dateMon, 25 Jan 2010 14:50:07 +0000
treeherderautoland@38e86af96757 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs540967
milestone1.9.3a1pre
Bug 540967 - "missing output line for total leaks" because the parent process isn't waiting for the child process to clean up/write leak logs, r=cjones
ipc/chromium/src/chrome/common/process_watcher.h
ipc/chromium/src/chrome/common/process_watcher_win.cc
ipc/glue/GeckoChildProcessHost.cpp
--- a/ipc/chromium/src/chrome/common/process_watcher.h
+++ b/ipc/chromium/src/chrome/common/process_watcher.h
@@ -19,17 +19,17 @@ class ProcessWatcher {
   // aggressive about ensuring that the process terminates.
   //
   // This method does not block the calling thread.
   //
   // NOTE: The process handle must have been opened with the PROCESS_TERMINATE
   // and SYNCHRONIZE permissions.
   //
   static void EnsureProcessTerminated(base::ProcessHandle process_handle
-#if defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_POSIX)
+#if defined(CHROMIUM_MOZILLA_BUILD)
                                       , bool force=true
 #endif
   );
 
  private:
   // Do not instantiate this class.
   ProcessWatcher();
 
--- a/ipc/chromium/src/chrome/common/process_watcher_win.cc
+++ b/ipc/chromium/src/chrome/common/process_watcher_win.cc
@@ -73,19 +73,31 @@ class TimerExpiredTask : public Task, pu
   base::ObjectWatcher watcher_;
 
   DISALLOW_EVIL_CONSTRUCTORS(TimerExpiredTask);
 };
 
 }  // namespace
 
 // static
-void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) {
+void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process
+#ifdef CHROMIUM_MOZILLA_BUILD
+					     , bool force
+#endif
+) {
   DCHECK(process != GetCurrentProcess());
 
+#ifdef CHROMIUM_MOZILLA_BUILD
+  if (!force) {
+    WaitForSingleObject(process, INFINITE);
+    CloseHandle(process);
+    return;
+  }
+#endif
+
   // If already signaled, then we are done!
   if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) {
     CloseHandle(process);
     return;
   }
 
   MessageLoop::current()->PostDelayedTask(FROM_HERE,
                                           new TimerExpiredTask(process),
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -86,17 +86,17 @@ GeckoChildProcessHost::~GeckoChildProces
 
 {
   AssertIOThread();
 
   MOZ_COUNT_DTOR(GeckoChildProcessHost);
 
   if (mChildProcessHandle > 0)
     ProcessWatcher::EnsureProcessTerminated(mChildProcessHandle
-#if defined(OS_POSIX) && defined(NS_BUILD_REFCNT_LOGGING)
+#if defined(NS_BUILD_REFCNT_LOGGING)
                                             , false // don't "force"
 #endif
     );
 }
 
 bool
 GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts)
 {