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

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: Renaming PROCESS_END_* to EXIT_CODE_* 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 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 953
954 void BrowserRenderProcessHost::OnChannelError() { 954 void BrowserRenderProcessHost::OnChannelError() {
955 // Our child process has died. If we didn't expect it, it's a crash. 955 // Our child process has died. If we didn't expect it, it's a crash.
956 // In any case, we need to let everyone know it's gone. 956 // In any case, we need to let everyone know it's gone.
957 // The OnChannelError notification can fire multiple times due to nested sync 957 // The OnChannelError notification can fire multiple times due to nested sync
958 // calls to a renderer. If we don't have a valid channel here it means we 958 // calls to a renderer. If we don't have a valid channel here it means we
959 // already handled the error. 959 // already handled the error.
960 if (!channel_.get()) 960 if (!channel_.get())
961 return; 961 return;
962 962
963 // NULL in single process mode or if fast termination happened. 963 // child_process_ can be NULL in single process mode or if fast
964 bool did_crash = 964 // termination happened.
965 child_process_.get() ? child_process_->DidProcessCrash() : false; 965 int exit_code = 0;
966 base::TerminationStatus status =
967 child_process_.get() ?
968 child_process_->GetChildTerminationStatus(&exit_code) :
969 base::TERMINATION_STATUS_NORMAL_TERMINATION;
966 970
967 if (did_crash) { 971 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
972 status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
968 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", 973 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes",
969 extension_process_ ? 2 : 1); 974 extension_process_ ? 2 : 1);
970 } 975 }
971 976
972 RendererClosedDetails details(did_crash, extension_process_); 977 if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
978 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildKills",
979 extension_process_ ? 2 : 1);
980 }
981
982 RendererClosedDetails details(status, exit_code, extension_process_);
973 NotificationService::current()->Notify( 983 NotificationService::current()->Notify(
974 NotificationType::RENDERER_PROCESS_CLOSED, 984 NotificationType::RENDERER_PROCESS_CLOSED,
975 Source<RenderProcessHost>(this), 985 Source<RenderProcessHost>(this),
976 Details<RendererClosedDetails>(&details)); 986 Details<RendererClosedDetails>(&details));
977 987
978 WebCacheManager::GetInstance()->Remove(id()); 988 WebCacheManager::GetInstance()->Remove(id());
979 child_process_.reset(); 989 child_process_.reset();
980 channel_.reset(); 990 channel_.reset();
981 991
982 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_); 992 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_);
983 while (!iter.IsAtEnd()) { 993 while (!iter.IsAtEnd()) {
984 iter.GetCurrentValue()->OnMessageReceived( 994 iter.GetCurrentValue()->OnMessageReceived(
985 ViewHostMsg_RenderViewGone(iter.GetCurrentKey())); 995 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(),
996 static_cast<int>(status),
997 exit_code));
986 iter.Advance(); 998 iter.Advance();
987 } 999 }
988 1000
989 ClearTransportDIBCache(); 1001 ClearTransportDIBCache();
990 1002
991 // this object is not deleted at this point and may be reused later. 1003 // this object is not deleted at this point and may be reused later.
992 // TODO(darin): clean this up 1004 // TODO(darin): clean this up
993 } 1005 }
994 1006
995 void BrowserRenderProcessHost::OnUpdatedCacheStats( 1007 void BrowserRenderProcessHost::OnUpdatedCacheStats(
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 IPC::InvalidPlatformFileForTransit(), 1185 IPC::InvalidPlatformFileForTransit(),
1174 std::vector<std::string>(), 1186 std::vector<std::string>(),
1175 std::string(), 1187 std::string(),
1176 false)); 1188 false));
1177 } 1189 }
1178 } 1190 }
1179 1191
1180 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { 1192 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) {
1181 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); 1193 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable));
1182 } 1194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698