| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 NOTREACHED(); | 647 NOTREACHED(); |
| 648 base::KillProcess(process, ResultCodes::KILLED_BAD_MESSAGE, false); | 648 base::KillProcess(process, ResultCodes::KILLED_BAD_MESSAGE, false); |
| 649 } | 649 } |
| 650 | 650 |
| 651 void BrowserRenderProcessHost::OnChannelError() { | 651 void BrowserRenderProcessHost::OnChannelError() { |
| 652 // Our child process has died. If we didn't expect it, it's a crash. | 652 // Our child process has died. If we didn't expect it, it's a crash. |
| 653 // In any case, we need to let everyone know it's gone. | 653 // In any case, we need to let everyone know it's gone. |
| 654 | 654 |
| 655 DCHECK(process_.handle()); | 655 DCHECK(process_.handle()); |
| 656 DCHECK(channel_.get()); | 656 DCHECK(channel_.get()); |
| 657 base::ProcessHandle process = process_.handle(); | |
| 658 | 657 |
| 659 bool clean_shutdown = !base::DidProcessCrash(process); | 658 if (base::DidProcessCrash(process_.handle())) { |
| 659 NotificationService::current()->Notify( |
| 660 NotificationType::RENDERER_PROCESS_CRASHED, |
| 661 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
| 662 } |
| 660 | 663 |
| 661 process_.Close(); | 664 process_.Close(); |
| 662 | |
| 663 channel_.reset(); | 665 channel_.reset(); |
| 664 | 666 |
| 665 if (!notified_termination_) { | |
| 666 // If |close_expected| is false, it means the renderer process went away | |
| 667 // before the web views expected it; count it as a crash. | |
| 668 NotificationService::current()->Notify( | |
| 669 NotificationType::RENDERER_PROCESS_TERMINATED, | |
| 670 Source<RenderProcessHost>(this), | |
| 671 Details<bool>(&clean_shutdown)); | |
| 672 notified_termination_ = true; | |
| 673 } | |
| 674 | |
| 675 // This process should detach all the listeners, causing the object to be | 667 // This process should detach all the listeners, causing the object to be |
| 676 // deleted. We therefore need a stack copy of the web view list to avoid | 668 // deleted. We therefore need a stack copy of the web view list to avoid |
| 677 // crashing when checking for the termination condition the last time. | 669 // crashing when checking for the termination condition the last time. |
| 678 IDMap<IPC::Channel::Listener> local_listeners(listeners_); | 670 IDMap<IPC::Channel::Listener> local_listeners(listeners_); |
| 679 for (listeners_iterator i = local_listeners.begin(); | 671 for (listeners_iterator i = local_listeners.begin(); |
| 680 i != local_listeners.end(); ++i) { | 672 i != local_listeners.end(); ++i) { |
| 681 i->second->OnMessageReceived(ViewHostMsg_RenderViewGone(i->first)); | 673 i->second->OnMessageReceived(ViewHostMsg_RenderViewGone(i->first)); |
| 682 } | 674 } |
| 683 | 675 |
| 684 ClearTransportDIBCache(); | 676 ClearTransportDIBCache(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 SendUserScriptsUpdate(shared_memory); | 763 SendUserScriptsUpdate(shared_memory); |
| 772 } | 764 } |
| 773 break; | 765 break; |
| 774 } | 766 } |
| 775 default: { | 767 default: { |
| 776 NOTREACHED(); | 768 NOTREACHED(); |
| 777 break; | 769 break; |
| 778 } | 770 } |
| 779 } | 771 } |
| 780 } | 772 } |
| OLD | NEW |