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

Unified Diff: chrome/browser/child_process_launcher.cc

Issue 5172009: This adds some plumbing for propagating the reason for a renderer's death (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final review changes Created 10 years 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 a4a610af8deb65ea628208c7922c0ccc57b8b016..8ba6941485bc10d9a891e4317b708ff273489713 100644
--- a/chrome/browser/child_process_launcher.cc
+++ b/chrome/browser/child_process_launcher.cc
@@ -311,28 +311,29 @@ 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 = ZygoteHost::GetInstance()->DidProcessCrash(handle,
- &child_exited);
+ status = ZygoteHost::GetInstance()->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