Chromium Code Reviews| Index: content/browser/child_process_launcher.cc |
| diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc |
| index e497762aff8ebbd651e8467c6c0409ff7c8f8fe2..cbf13e97adf4a2fdb50233c895227e03485828cc 100644 |
| --- a/content/browser/child_process_launcher.cc |
| +++ b/content/browser/child_process_launcher.cc |
| @@ -339,9 +339,6 @@ class ChildProcessLauncher::Context |
| if (!process_.handle()) |
| return; |
| - if (!terminate_child_on_shutdown_) |
| - return; |
| - |
| // On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep! So |
| // don't this on the UI/IO threads. |
| BrowserThread::PostTask( |
| @@ -351,7 +348,8 @@ class ChildProcessLauncher::Context |
| #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| zygote_, |
| #endif |
| - process_.handle())); |
| + process_.handle(), |
| + !terminate_child_on_shutdown_)); |
| process_.set_handle(base::kNullProcessHandle); |
| } |
| @@ -365,7 +363,8 @@ class ChildProcessLauncher::Context |
| #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| bool zygote, |
| #endif |
| - base::ProcessHandle handle) { |
| + base::ProcessHandle handle, |
| + bool wait_for_child_to_exit_cleanly) { |
| #if defined(OS_ANDROID) |
| LOG(INFO) << "ChromeProcess: Stopping process with handle " << handle; |
| StopChildProcess(handle); |
| @@ -373,7 +372,9 @@ class ChildProcessLauncher::Context |
| base::Process process(handle); |
| // Client has gone away, so just kill the process. Using exit code 0 |
| // means that UMA won't treat this as a crash. |
| - process.Terminate(RESULT_CODE_NORMAL_EXIT); |
| + if (!wait_for_child_to_exit_cleanly) |
| + process.Terminate(RESULT_CODE_NORMAL_EXIT); |
| + |
| // On POSIX, we must additionally reap the child. |
| #if defined(OS_POSIX) |
| #if !defined(OS_MACOSX) |
| @@ -384,7 +385,10 @@ class ChildProcessLauncher::Context |
| } else |
| #endif // !OS_MACOSX |
| { |
| - base::EnsureProcessTerminated(handle); |
| + if (wait_for_child_to_exit_cleanly) |
| + base::EnsureProcessGetsReaped(handle); |
|
Markus (顧孟勤)
2013/07/22 22:50:13
I am really sad that we need to launch another thr
asharif1
2013/07/22 23:43:54
Note that the zygote process isn't multithreaded b
Markus (顧孟勤)
2013/07/22 23:54:27
If writing a synchronous version is possible witho
|
| + else |
| + base::EnsureProcessTerminated(handle); |
| } |
| #endif // OS_POSIX |
| process.Close(); |