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

Unified Diff: chrome/browser/browser_child_process_host.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: Upload after sync for proper diffs 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/browser_child_process_host.cc
diff --git a/chrome/browser/browser_child_process_host.cc b/chrome/browser/browser_child_process_host.cc
index 5cfd53611f1e511292cd4d07a71f4f6354e19775..afe428efa1d89c3e1be2d40a5259a0bb95a0b48e 100644
--- a/chrome/browser/browser_child_process_host.cc
+++ b/chrome/browser/browser_child_process_host.cc
@@ -139,18 +139,34 @@ void BrowserChildProcessHost::Notify(NotificationType type) {
BrowserThread::UI, FROM_HERE, new ChildNotificationTask(type, this));
}
-bool BrowserChildProcessHost::DidChildCrash() {
- return child_process_->DidProcessCrash();
+base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus(
+ int* exit_code) {
+ return child_process_->GetChildTerminationStatus(exit_code);
}
void BrowserChildProcessHost::OnChildDied() {
if (handle() != base::kNullProcessHandle) {
- bool did_crash = DidChildCrash();
- if (did_crash) {
- OnProcessCrashed();
- // Report that this child process crashed.
- Notify(NotificationType::CHILD_PROCESS_CRASHED);
- UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type());
+ int exit_code;
+ base::TerminationStatus status = GetChildTerminationStatus(&exit_code);
+ switch (status) {
brettw 2010/12/03 01:01:54 Random suggestion: I would probably write switch
+ case base::TERMINATION_STATUS_PROCESS_CRASHED: {
+ OnProcessCrashed(exit_code);
+
+ // Report that this child process crashed.
+ Notify(NotificationType::CHILD_PROCESS_CRASHED);
+ UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type());
+ break;
+ }
+ case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: {
+ OnProcessWasKilled(exit_code);
+
+ // Report that this child process was killed.
+ Notify(NotificationType::CHILD_PROCESS_WAS_KILLED);
+ UMA_HISTOGRAM_COUNTS("ChildProcess.Kills", this->type());
+ break;
+ }
+ default:
+ break;
}
// Notify in the main loop of the disconnection.
Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED);

Powered by Google App Engine
This is Rietveld 408576698