| 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 = base::DidProcessCrash(&child_exited, process_.handle()); | 724 bool did_crash; |
| 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 } |
| 725 | 736 |
| 726 NotificationService::current()->Notify( | 737 NotificationService::current()->Notify( |
| 727 NotificationType::RENDERER_PROCESS_CLOSED, | 738 NotificationType::RENDERER_PROCESS_CLOSED, |
| 728 Source<RenderProcessHost>(this), | 739 Source<RenderProcessHost>(this), |
| 729 Details<bool>(&did_crash)); | 740 Details<bool>(&did_crash)); |
| 730 | 741 |
| 731 // POSIX: If the process crashed, then the kernel closed the socket for it | 742 // POSIX: If the process crashed, then the kernel closed the socket for it |
| 732 // and so the child has already died by the time we get here. Since | 743 // and so the child has already died by the time we get here. Since |
| 733 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. | 744 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. |
| 734 // However, if DidProcessCrash didn't reap the child, we'll need to in | 745 // 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... |
| 850 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 861 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
| 851 ems->AddEventListener(event_name, pid()); | 862 ems->AddEventListener(event_name, pid()); |
| 852 } | 863 } |
| 853 | 864 |
| 854 void BrowserRenderProcessHost::OnExtensionRemoveListener( | 865 void BrowserRenderProcessHost::OnExtensionRemoveListener( |
| 855 const std::string& event_name) { | 866 const std::string& event_name) { |
| 856 URLRequestContext* context = profile()->GetRequestContext(); | 867 URLRequestContext* context = profile()->GetRequestContext(); |
| 857 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 868 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); |
| 858 ems->RemoveEventListener(event_name, pid()); | 869 ems->RemoveEventListener(event_name, pid()); |
| 859 } | 870 } |
| OLD | NEW |