| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } | 714 } |
| 715 | 715 |
| 716 void BrowserRenderProcessHost::OnChannelError() { | 716 void BrowserRenderProcessHost::OnChannelError() { |
| 717 // Our child process has died. If we didn't expect it, it's a crash. | 717 // Our child process has died. If we didn't expect it, it's a crash. |
| 718 // In any case, we need to let everyone know it's gone. | 718 // In any case, we need to let everyone know it's gone. |
| 719 | 719 |
| 720 DCHECK(process_.handle()); | 720 DCHECK(process_.handle()); |
| 721 DCHECK(channel_.get()); | 721 DCHECK(channel_.get()); |
| 722 | 722 |
| 723 bool child_exited; | 723 bool child_exited; |
| 724 bool did_crash; | 724 bool did_crash = base::DidProcessCrash(&child_exited, process_.handle()); |
| 725 if (zygote_child_) { | |
| 726 #if defined(OS_LINUX) | |
| 727 did_crash = Singleton<ZygoteHost>()->DidProcessCrash( | |
| 728 process_.handle(), &child_exited); | |
| 729 #else | |
| 730 NOTREACHED(); | |
| 731 did_crash = true; | |
| 732 #endif | |
| 733 } else { | |
| 734 did_crash = base::DidProcessCrash(&child_exited, process_.handle()); | |
| 735 } | |
| 736 | 725 |
| 737 NotificationService::current()->Notify( | 726 NotificationService::current()->Notify( |
| 738 NotificationType::RENDERER_PROCESS_CLOSED, | 727 NotificationType::RENDERER_PROCESS_CLOSED, |
| 739 Source<RenderProcessHost>(this), | 728 Source<RenderProcessHost>(this), |
| 740 Details<bool>(&did_crash)); | 729 Details<bool>(&did_crash)); |
| 741 | 730 |
| 742 // POSIX: If the process crashed, then the kernel closed the socket for it | 731 // POSIX: If the process crashed, then the kernel closed the socket for it |
| 743 // and so the child has already died by the time we get here. Since | 732 // and so the child has already died by the time we get here. Since |
| 744 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. | 733 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. |
| 745 // However, if DidProcessCrash didn't reap the child, we'll need to in | 734 // However, if DidProcessCrash didn't reap the child, we'll need to in |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 850 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
| 862 ems->AddEventListener(event_name, pid()); | 851 ems->AddEventListener(event_name, pid()); |
| 863 } | 852 } |
| 864 | 853 |
| 865 void BrowserRenderProcessHost::OnExtensionRemoveListener( | 854 void BrowserRenderProcessHost::OnExtensionRemoveListener( |
| 866 const std::string& event_name) { | 855 const std::string& event_name) { |
| 867 URLRequestContext* context = profile()->GetRequestContext(); | 856 URLRequestContext* context = profile()->GetRequestContext(); |
| 868 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 857 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
| 869 ems->RemoveEventListener(event_name, pid()); | 858 ems->RemoveEventListener(event_name, pid()); |
| 870 } | 859 } |
| OLD | NEW |