OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 681 |
682 if (gpu_observer_registered_) { | 682 if (gpu_observer_registered_) { |
683 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); | 683 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); |
684 gpu_observer_registered_ = false; | 684 gpu_observer_registered_ = false; |
685 } | 685 } |
686 | 686 |
687 #if USE_ATTACHMENT_BROKER | 687 #if USE_ATTACHMENT_BROKER |
688 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( | 688 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( |
689 channel_.get()); | 689 channel_.get()); |
690 #endif | 690 #endif |
| 691 |
691 // We may have some unsent messages at this point, but that's OK. | 692 // We may have some unsent messages at this point, but that's OK. |
692 channel_.reset(); | 693 channel_.reset(); |
693 while (!queued_messages_.empty()) { | 694 while (!queued_messages_.empty()) { |
694 delete queued_messages_.front(); | 695 delete queued_messages_.front(); |
695 queued_messages_.pop(); | 696 queued_messages_.pop(); |
696 } | 697 } |
697 | 698 |
698 UnregisterHost(GetID()); | 699 UnregisterHost(GetID()); |
699 | 700 |
700 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 701 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 880 |
880 scoped_refptr<net::URLRequestContextGetter> request_context( | 881 scoped_refptr<net::URLRequestContextGetter> request_context( |
881 storage_partition_impl_->GetURLRequestContext()); | 882 storage_partition_impl_->GetURLRequestContext()); |
882 scoped_refptr<RenderMessageFilter> render_message_filter( | 883 scoped_refptr<RenderMessageFilter> render_message_filter( |
883 new RenderMessageFilter( | 884 new RenderMessageFilter( |
884 GetID(), GetBrowserContext(), request_context.get(), | 885 GetID(), GetBrowserContext(), request_context.get(), |
885 widget_helper_.get(), audio_manager, media_internals, | 886 widget_helper_.get(), audio_manager, media_internals, |
886 storage_partition_impl_->GetDOMStorageContext(), | 887 storage_partition_impl_->GetDOMStorageContext(), |
887 storage_partition_impl_->GetCacheStorageContext())); | 888 storage_partition_impl_->GetCacheStorageContext())); |
888 AddFilter(render_message_filter.get()); | 889 AddFilter(render_message_filter.get()); |
889 AddFilter(new RenderFrameMessageFilter( | 890 |
| 891 render_frame_message_filter_ = new RenderFrameMessageFilter( |
890 GetID(), | 892 GetID(), |
891 #if defined(ENABLE_PLUGINS) | 893 #if defined(ENABLE_PLUGINS) |
892 PluginServiceImpl::GetInstance(), | 894 PluginServiceImpl::GetInstance(), |
893 #else | 895 #else |
894 nullptr, | 896 nullptr, |
895 #endif | 897 #endif |
896 GetBrowserContext(), | 898 GetBrowserContext(), |
897 request_context.get(), | 899 request_context.get(), |
898 widget_helper_.get())); | 900 widget_helper_.get()); |
| 901 AddFilter(render_frame_message_filter_.get()); |
| 902 |
899 BrowserContext* browser_context = GetBrowserContext(); | 903 BrowserContext* browser_context = GetBrowserContext(); |
900 ResourceContext* resource_context = browser_context->GetResourceContext(); | 904 ResourceContext* resource_context = browser_context->GetResourceContext(); |
901 | 905 |
902 scoped_refptr<net::URLRequestContextGetter> media_request_context( | 906 scoped_refptr<net::URLRequestContextGetter> media_request_context( |
903 GetStoragePartition()->GetMediaURLRequestContext()); | 907 GetStoragePartition()->GetMediaURLRequestContext()); |
904 | 908 |
905 ResourceMessageFilter::GetContextsCallback get_contexts_callback( | 909 ResourceMessageFilter::GetContextsCallback get_contexts_callback( |
906 base::Bind(&GetContexts, browser_context->GetResourceContext(), | 910 base::Bind(&GetContexts, browser_context->GetResourceContext(), |
907 request_context, media_request_context)); | 911 request_context, media_request_context)); |
908 | 912 |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 } | 2435 } |
2432 } | 2436 } |
2433 | 2437 |
2434 RendererClosedDetails details(status, exit_code); | 2438 RendererClosedDetails details(status, exit_code); |
2435 | 2439 |
2436 child_process_launcher_.reset(); | 2440 child_process_launcher_.reset(); |
2437 #if USE_ATTACHMENT_BROKER | 2441 #if USE_ATTACHMENT_BROKER |
2438 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( | 2442 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( |
2439 channel_.get()); | 2443 channel_.get()); |
2440 #endif | 2444 #endif |
| 2445 |
2441 channel_.reset(); | 2446 channel_.reset(); |
2442 while (!queued_messages_.empty()) { | 2447 while (!queued_messages_.empty()) { |
2443 delete queued_messages_.front(); | 2448 delete queued_messages_.front(); |
2444 queued_messages_.pop(); | 2449 queued_messages_.pop(); |
2445 } | 2450 } |
2446 UpdateProcessPriority(); | 2451 UpdateProcessPriority(); |
2447 DCHECK(!is_process_backgrounded_); | 2452 DCHECK(!is_process_backgrounded_); |
2448 | 2453 |
2449 // RenderProcessExited observers and RenderProcessGone handlers might | 2454 // RenderProcessExited observers and RenderProcessGone handlers might |
2450 // navigate or perform other actions that require a connection. Ensure that | 2455 // navigate or perform other actions that require a connection. Ensure that |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2790 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2786 | 2791 |
2787 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2792 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2788 // enough information here so that we can determine what the bad message was. | 2793 // enough information here so that we can determine what the bad message was. |
2789 base::debug::Alias(&error); | 2794 base::debug::Alias(&error); |
2790 bad_message::ReceivedBadMessage(process.get(), | 2795 bad_message::ReceivedBadMessage(process.get(), |
2791 bad_message::RPH_MOJO_PROCESS_ERROR); | 2796 bad_message::RPH_MOJO_PROCESS_ERROR); |
2792 } | 2797 } |
2793 | 2798 |
2794 } // namespace content | 2799 } // namespace content |
OLD | NEW |