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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 | 869 |
870 void BrowserRenderProcessHost::OnChannelError() { | 870 void BrowserRenderProcessHost::OnChannelError() { |
871 // Our child process has died. If we didn't expect it, it's a crash. | 871 // Our child process has died. If we didn't expect it, it's a crash. |
872 // In any case, we need to let everyone know it's gone. | 872 // In any case, we need to let everyone know it's gone. |
873 // The OnChannelError notification can fire multiple times due to nested sync | 873 // The OnChannelError notification can fire multiple times due to nested sync |
874 // calls to a renderer. If we don't have a valid channel here it means we | 874 // calls to a renderer. If we don't have a valid channel here it means we |
875 // already handled the error. | 875 // already handled the error. |
876 if (!channel_.get()) | 876 if (!channel_.get()) |
877 return; | 877 return; |
878 | 878 |
879 // NULL in single process mode or if fast termination happened. | 879 // child_process_ can be NULL in single process mode or if fast |
880 bool did_crash = | 880 // termination happened. |
881 child_process_.get() ? child_process_->DidProcessCrash() : false; | 881 int exit_code = 0; |
| 882 base::TerminationStatus status = |
| 883 child_process_.get() ? |
| 884 child_process_->GetChildTerminationStatus(&exit_code) : |
| 885 base::TERMINATION_STATUS_NORMAL_TERMINATION; |
882 | 886 |
883 if (did_crash) { | 887 if (status == base::TERMINATION_STATUS_PROCESS_CRASHED) { |
884 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", | 888 UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", |
885 extension_process_ ? 2 : 1); | 889 extension_process_ ? 2 : 1); |
886 } | 890 } |
887 | 891 |
888 RendererClosedDetails details(did_crash, extension_process_); | 892 RendererClosedDetails details(status, exit_code, extension_process_); |
889 NotificationService::current()->Notify( | 893 NotificationService::current()->Notify( |
890 NotificationType::RENDERER_PROCESS_CLOSED, | 894 NotificationType::RENDERER_PROCESS_CLOSED, |
891 Source<RenderProcessHost>(this), | 895 Source<RenderProcessHost>(this), |
892 Details<RendererClosedDetails>(&details)); | 896 Details<RendererClosedDetails>(&details)); |
893 | 897 |
894 WebCacheManager::GetInstance()->Remove(id()); | 898 WebCacheManager::GetInstance()->Remove(id()); |
895 child_process_.reset(); | 899 child_process_.reset(); |
896 channel_.reset(); | 900 channel_.reset(); |
897 | 901 |
898 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_); | 902 IDMap<IPC::Channel::Listener>::iterator iter(&listeners_); |
899 while (!iter.IsAtEnd()) { | 903 while (!iter.IsAtEnd()) { |
900 iter.GetCurrentValue()->OnMessageReceived( | 904 iter.GetCurrentValue()->OnMessageReceived( |
901 ViewHostMsg_RenderViewGone(iter.GetCurrentKey())); | 905 ViewHostMsg_RenderViewGone(iter.GetCurrentKey(), |
| 906 static_cast<int>(status), |
| 907 exit_code)); |
902 iter.Advance(); | 908 iter.Advance(); |
903 } | 909 } |
904 | 910 |
905 ClearTransportDIBCache(); | 911 ClearTransportDIBCache(); |
906 | 912 |
907 // this object is not deleted at this point and may be reused later. | 913 // this object is not deleted at this point and may be reused later. |
908 // TODO(darin): clean this up | 914 // TODO(darin): clean this up |
909 } | 915 } |
910 | 916 |
911 void BrowserRenderProcessHost::OnUpdatedCacheStats( | 917 void BrowserRenderProcessHost::OnUpdatedCacheStats( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 IPC::InvalidPlatformFileForTransit(), | 1087 IPC::InvalidPlatformFileForTransit(), |
1082 std::vector<std::string>(), | 1088 std::vector<std::string>(), |
1083 std::string(), | 1089 std::string(), |
1084 false)); | 1090 false)); |
1085 } | 1091 } |
1086 } | 1092 } |
1087 | 1093 |
1088 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { | 1094 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { |
1089 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); | 1095 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); |
1090 } | 1096 } |
OLD | NEW |