| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 // In single process mode it is better if we don't suicide but just crash. | 879 // In single process mode it is better if we don't suicide but just crash. |
| 880 CHECK(false); | 880 CHECK(false); |
| 881 } | 881 } |
| 882 NOTREACHED(); | 882 NOTREACHED(); |
| 883 base::KillProcess(process, ResultCodes::KILLED_BAD_MESSAGE, false); | 883 base::KillProcess(process, ResultCodes::KILLED_BAD_MESSAGE, false); |
| 884 } | 884 } |
| 885 | 885 |
| 886 void BrowserRenderProcessHost::OnChannelError() { | 886 void BrowserRenderProcessHost::OnChannelError() { |
| 887 // Our child process has died. If we didn't expect it, it's a crash. | 887 // Our child process has died. If we didn't expect it, it's a crash. |
| 888 // In any case, we need to let everyone know it's gone. | 888 // In any case, we need to let everyone know it's gone. |
| 889 DCHECK(channel_.get()); | 889 // The OnChannelError notification can fire multiple times due to nested sync |
| 890 // calls to a renderer. If we don't have a valid channel here it means we |
| 891 // already handled the error. |
| 892 if (!channel_.get()) |
| 893 return; |
| 890 | 894 |
| 891 bool child_exited; | 895 bool child_exited; |
| 892 bool did_crash; | 896 bool did_crash; |
| 893 if (!process_.handle()) { | 897 if (!process_.handle()) { |
| 894 // The process has been terminated (likely FastShutdownIfPossible). | 898 // The process has been terminated (likely FastShutdownIfPossible). |
| 895 did_crash = false; | 899 did_crash = false; |
| 896 child_exited = true; | 900 child_exited = true; |
| 897 } else if (zygote_child_) { | 901 } else if (zygote_child_) { |
| 898 #if defined(OS_LINUX) | 902 #if defined(OS_LINUX) |
| 899 did_crash = Singleton<ZygoteHost>()->DidProcessCrash( | 903 did_crash = Singleton<ZygoteHost>()->DidProcessCrash( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 profile()->GetExtensionMessageService()->RemoveEventListener( | 1027 profile()->GetExtensionMessageService()->RemoveEventListener( |
| 1024 event_name, id()); | 1028 event_name, id()); |
| 1025 } | 1029 } |
| 1026 } | 1030 } |
| 1027 | 1031 |
| 1028 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { | 1032 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { |
| 1029 if (profile()->GetExtensionMessageService()) { | 1033 if (profile()->GetExtensionMessageService()) { |
| 1030 profile()->GetExtensionMessageService()->CloseChannel(port_id); | 1034 profile()->GetExtensionMessageService()->CloseChannel(port_id); |
| 1031 } | 1035 } |
| 1032 } | 1036 } |
| OLD | NEW |