Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: chrome/browser/child_process_launcher.cc

Issue 3386014: This adds some plumbing for propagating the status and error code of a (Closed)
Patch Set: Fixed Mac code to handle both SEGV and BUS Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/child_process_launcher.cc
diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc
index ad464c13829734e8c9a4ed07e8869cfaf8a9aa26..60d87d444dd68b48067d2066710f48c9a1f2fa5b 100644
--- a/chrome/browser/child_process_launcher.cc
+++ b/chrome/browser/child_process_launcher.cc
@@ -308,27 +308,30 @@ base::ProcessHandle ChildProcessLauncher::GetHandle() {
return context_->process_.handle();
}
-bool ChildProcessLauncher::DidProcessCrash() {
- bool did_crash, child_exited;
+base::TerminationStatus ChildProcessLauncher::GetChildTerminationStatus(
+ int* exit_code) {
+ base::TerminationStatus status;
base::ProcessHandle handle = context_->process_.handle();
#if defined(OS_LINUX)
if (context_->zygote_) {
- did_crash = Singleton<ZygoteHost>()->DidProcessCrash(handle, &child_exited);
+ status = Singleton<ZygoteHost>()->GetTerminationStatus(handle,
+ exit_code);
} else
#endif
{
- did_crash = base::DidProcessCrash(&child_exited, handle);
+ status = base::GetTerminationStatus(handle, exit_code);
}
- // POSIX: If the process crashed, then the kernel closed the socket for it
- // and so the child has already died by the time we get here. Since
- // DidProcessCrash called waitpid with WNOHANG, it'll reap the process.
- // However, if DidProcessCrash didn't reap the child, we'll need to in
+ // POSIX: If the process crashed, then the kernel closed the socket
+ // for it and so the child has already died by the time we get
+ // here. Since GetTerminationStatus called waitpid with WNOHANG,
+ // it'll reap the process. However, if GetTerminationStatus didn't
+ // reap the child (because it was still running), we'll need to
// Terminate via ProcessWatcher. So we can't close the handle here.
- if (child_exited)
+ if (status != base::TERMINATION_STATUS_STILL_RUNNING)
context_->process_.Close();
- return did_crash;
+ return status;
}
void ChildProcessLauncher::SetProcessBackgrounded(bool background) {
« no previous file with comments | « chrome/browser/child_process_launcher.h ('k') | chrome/browser/child_process_security_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698