OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/browser_render_process_host.h" | 8 #include "content/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 646 |
647 // Test if there's an unload listener. | 647 // Test if there's an unload listener. |
648 // NOTE: It's possible that an onunload listener may be installed | 648 // NOTE: It's possible that an onunload listener may be installed |
649 // while we're shutting down, so there's a small race here. Given that | 649 // while we're shutting down, so there's a small race here. Given that |
650 // the window is small, it's unlikely that the web page has much | 650 // the window is small, it's unlikely that the web page has much |
651 // state that will be lost by not calling its unload handlers properly. | 651 // state that will be lost by not calling its unload handlers properly. |
652 if (!sudden_termination_allowed()) | 652 if (!sudden_termination_allowed()) |
653 return false; | 653 return false; |
654 | 654 |
655 child_process_launcher_.reset(); | 655 child_process_launcher_.reset(); |
| 656 ProcessDied(); |
656 fast_shutdown_started_ = true; | 657 fast_shutdown_started_ = true; |
657 return true; | 658 return true; |
658 } | 659 } |
659 | 660 |
660 // This is a platform specific function for mapping a transport DIB given its id | 661 // This is a platform specific function for mapping a transport DIB given its id |
661 TransportDIB* BrowserRenderProcessHost::MapTransportDIB( | 662 TransportDIB* BrowserRenderProcessHost::MapTransportDIB( |
662 TransportDIB::Id dib_id) { | 663 TransportDIB::Id dib_id) { |
663 #if defined(OS_WIN) | 664 #if defined(OS_WIN) |
664 // On Windows we need to duplicate the handle from the remote process | 665 // On Windows we need to duplicate the handle from the remote process |
665 HANDLE section = chrome::GetSectionFromProcess( | 666 HANDLE section = chrome::GetSectionFromProcess( |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 Send(new ChildProcessMsg_SetIPCLoggingEnabled( | 796 Send(new ChildProcessMsg_SetIPCLoggingEnabled( |
796 IPC::Logging::GetInstance()->Enabled())); | 797 IPC::Logging::GetInstance()->Enabled())); |
797 #endif | 798 #endif |
798 | 799 |
799 // Make sure the child checks with us before exiting, so that we do not try | 800 // Make sure the child checks with us before exiting, so that we do not try |
800 // to schedule a new navigation in a swapped out and exiting renderer. | 801 // to schedule a new navigation in a swapped out and exiting renderer. |
801 Send(new ChildProcessMsg_AskBeforeShutdown()); | 802 Send(new ChildProcessMsg_AskBeforeShutdown()); |
802 } | 803 } |
803 | 804 |
804 void BrowserRenderProcessHost::OnChannelError() { | 805 void BrowserRenderProcessHost::OnChannelError() { |
| 806 ProcessDied(); |
| 807 } |
| 808 |
| 809 void BrowserRenderProcessHost::ProcessDied() { |
805 // Our child process has died. If we didn't expect it, it's a crash. | 810 // Our child process has died. If we didn't expect it, it's a crash. |
806 // In any case, we need to let everyone know it's gone. | 811 // In any case, we need to let everyone know it's gone. |
807 // The OnChannelError notification can fire multiple times due to nested sync | 812 // The OnChannelError notification can fire multiple times due to nested sync |
808 // calls to a renderer. If we don't have a valid channel here it means we | 813 // calls to a renderer. If we don't have a valid channel here it means we |
809 // already handled the error. | 814 // already handled the error. |
810 if (!channel_.get()) | 815 if (!channel_.get()) |
811 return; | 816 return; |
812 | 817 |
813 // child_process_launcher_ can be NULL in single process mode or if fast | 818 // child_process_launcher_ can be NULL in single process mode or if fast |
814 // termination happened. | 819 // termination happened. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 942 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
938 // Only honor the request if appropriate persmissions are granted. | 943 // Only honor the request if appropriate persmissions are granted. |
939 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 944 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
940 content::GetContentClient()->browser()->OpenItem(path); | 945 content::GetContentClient()->browser()->OpenItem(path); |
941 } | 946 } |
942 | 947 |
943 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { | 948 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { |
944 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 949 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
945 MHTMLGenerated(job_id, success); | 950 MHTMLGenerated(job_id, success); |
946 } | 951 } |
OLD | NEW |