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

Side by Side Diff: chrome/browser/renderer_host/browser_render_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: Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" 8 #include "chrome/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 952
953 void BrowserRenderProcessHost::OnChannelError() { 953 void BrowserRenderProcessHost::OnChannelError() {
954 // Our child process has died. If we didn't expect it, it's a crash. 954 // Our child process has died. If we didn't expect it, it's a crash.
955 // In any case, we need to let everyone know it's gone. 955 // In any case, we need to let everyone know it's gone.
956 // The OnChannelError notification can fire multiple times due to nested sync 956 // The OnChannelError notification can fire multiple times due to nested sync
957 // calls to a renderer. If we don't have a valid channel here it means we 957 // calls to a renderer. If we don't have a valid channel here it means we
958 // already handled the error. 958 // already handled the error.
959 if (!channel_.get()) 959 if (!channel_.get())
960 return; 960 return;
961 961
962 // NULL in single process mode or if fast termination happened. 962 // child_process_ can be NULL in single process mode or if fast
963 bool did_crash = 963 // termination happened.
964 child_process_.get() ? child_process_->DidProcessCrash() : false; 964 int exit_code = 0;
965 base::TerminationStatus status =
966 child_process_.get() ?
967 child_process_->GetChildTerminationStatus(&exit_code) :
968 base::TERMINATION_STATUS_NORMAL_TERMINATION;
965 969
966 if (did_crash) { 970 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED) {
967 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", 971 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes",
968 extension_process_ ? 2 : 1); 972 extension_process_ ? 2 : 1);
969 } 973 }
970 974
971 RendererClosedDetails details(did_crash, extension_process_); 975 RendererClosedDetails details(status, exit_code, extension_process_);
972 NotificationService::current()->Notify( 976 NotificationService::current()->Notify(
973 NotificationType::RENDERER_PROCESS_CLOSED, 977 NotificationType::RENDERER_PROCESS_CLOSED,
974 Source<RenderProcessHost>(this), 978 Source<RenderProcessHost>(this),
975 Details<RendererClosedDetails>(&details)); 979 Details<RendererClosedDetails>(&details));
976 980
977 WebCacheManager::GetInstance()->Remove(id()); 981 WebCacheManager::GetInstance()->Remove(id());
978 child_process_.reset(); 982 child_process_.reset();
979 channel_.reset(); 983 channel_.reset();
980 984
981 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_); 985 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_);
982 while (!iter.IsAtEnd()) { 986 while (!iter.IsAtEnd()) {
983 iter.GetCurrentValue()->OnMessageReceived( 987 iter.GetCurrentValue()->OnMessageReceived(
984 ViewHostMsg_RenderViewGone(iter.GetCurrentKey())); 988 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(),
989 static_cast<int>(status),
990 exit_code));
985 iter.Advance(); 991 iter.Advance();
986 } 992 }
987 993
988 ClearTransportDIBCache(); 994 ClearTransportDIBCache();
989 995
990 // this object is not deleted at this point and may be reused later. 996 // this object is not deleted at this point and may be reused later.
991 // TODO(darin): clean this up 997 // TODO(darin): clean this up
992 } 998 }
993 999
994 void BrowserRenderProcessHost::OnUpdatedCacheStats( 1000 void BrowserRenderProcessHost::OnUpdatedCacheStats(
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 IPC::InvalidPlatformFileForTransit(), 1178 IPC::InvalidPlatformFileForTransit(),
1173 std::vector<std::string>(), 1179 std::vector<std::string>(),
1174 std::string(), 1180 std::string(),
1175 false)); 1181 false));
1176 } 1182 }
1177 } 1183 }
1178 1184
1179 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { 1185 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) {
1180 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); 1186 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable));
1181 } 1187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698