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
--- 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)
{