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