Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2434103002: Remove uses of AttachmentBroker from //content and //components/nacl. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 #include "content/public/common/result_codes.h" 159 #include "content/public/common/result_codes.h"
160 #include "content/public/common/sandboxed_process_launcher_delegate.h" 160 #include "content/public/common/sandboxed_process_launcher_delegate.h"
161 #include "content/public/common/service_names.h" 161 #include "content/public/common/service_names.h"
162 #include "content/public/common/url_constants.h" 162 #include "content/public/common/url_constants.h"
163 #include "device/battery/battery_monitor_impl.h" 163 #include "device/battery/battery_monitor_impl.h"
164 #include "device/time_zone_monitor/time_zone_monitor.h" 164 #include "device/time_zone_monitor/time_zone_monitor.h"
165 #include "gpu/GLES2/gl2extchromium.h" 165 #include "gpu/GLES2/gl2extchromium.h"
166 #include "gpu/command_buffer/client/gpu_switches.h" 166 #include "gpu/command_buffer/client/gpu_switches.h"
167 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 167 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
168 #include "gpu/command_buffer/service/gpu_switches.h" 168 #include "gpu/command_buffer/service/gpu_switches.h"
169 #include "ipc/attachment_broker.h"
170 #include "ipc/attachment_broker_privileged.h"
171 #include "ipc/ipc.mojom.h" 169 #include "ipc/ipc.mojom.h"
172 #include "ipc/ipc_channel.h" 170 #include "ipc/ipc_channel.h"
173 #include "ipc/ipc_channel_mojo.h" 171 #include "ipc/ipc_channel_mojo.h"
174 #include "ipc/ipc_logging.h" 172 #include "ipc/ipc_logging.h"
175 #include "media/base/media_switches.h" 173 #include "media/base/media_switches.h"
176 #include "mojo/edk/embedder/embedder.h" 174 #include "mojo/edk/embedder/embedder.h"
177 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" 175 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
178 #include "net/url_request/url_request_context_getter.h" 176 #include "net/url_request/url_request_context_getter.h"
179 #include "ppapi/shared_impl/ppapi_switches.h" 177 #include "ppapi/shared_impl/ppapi_switches.h"
180 #include "services/service_manager/public/cpp/connection.h" 178 #include "services/service_manager/public/cpp/connection.h"
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 713 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
716 base::Bind(&CacheShaderInfo, GetID(), 714 base::Bind(&CacheShaderInfo, GetID(),
717 storage_partition_impl_->GetPath())); 715 storage_partition_impl_->GetPath()));
718 } 716 }
719 717
720 #if defined(OS_MACOSX) 718 #if defined(OS_MACOSX)
721 if (BootstrapSandboxManager::ShouldEnable()) 719 if (BootstrapSandboxManager::ShouldEnable())
722 AddObserver(BootstrapSandboxManager::GetInstance()); 720 AddObserver(BootstrapSandboxManager::GetInstance());
723 #endif 721 #endif
724 722
725 #if USE_ATTACHMENT_BROKER
726 // Construct the privileged attachment broker early in the life cycle of a
727 // render process. This ensures that when a test is being run in one of the
728 // single process modes, the global attachment broker is the privileged
729 // attachment broker, rather than an unprivileged attachment broker.
730 #if defined(OS_MACOSX)
731 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
732 MachBroker::GetInstance());
733 #else
734 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
735 #endif // defined(OS_MACOSX)
736 #endif // USE_ATTACHMENT_BROKER
737
738 InitializeChannelProxy(); 723 InitializeChannelProxy();
739 } 724 }
740 725
741 // static 726 // static
742 void RenderProcessHostImpl::ShutDownInProcessRenderer() { 727 void RenderProcessHostImpl::ShutDownInProcessRenderer() {
743 DCHECK(g_run_renderer_in_process_); 728 DCHECK(g_run_renderer_in_process_);
744 729
745 switch (g_all_hosts.Pointer()->size()) { 730 switch (g_all_hosts.Pointer()->size()) {
746 case 0: 731 case 0:
747 return; 732 return;
(...skipping 30 matching lines...) Expand all
778 // it may still run and have its IPCs fail, causing asserts. 763 // it may still run and have its IPCs fail, causing asserts.
779 in_process_renderer_.reset(); 764 in_process_renderer_.reset();
780 765
781 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); 766 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID());
782 767
783 if (gpu_observer_registered_) { 768 if (gpu_observer_registered_) {
784 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); 769 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this);
785 gpu_observer_registered_ = false; 770 gpu_observer_registered_ = false;
786 } 771 }
787 772
788 #if USE_ATTACHMENT_BROKER
789 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
790 channel_.get());
791 #endif
792
793 is_dead_ = true; 773 is_dead_ = true;
794 774
795 UnregisterHost(GetID()); 775 UnregisterHost(GetID());
796 776
797 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 777 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
798 switches::kDisableGpuShaderDiskCache)) { 778 switches::kDisableGpuShaderDiskCache)) {
799 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 779 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
800 base::Bind(&RemoveShaderInfo, GetID())); 780 base::Bind(&RemoveShaderInfo, GetID()));
801 } 781 }
802 } 782 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 // for Android WebView to maintain backward compatibility. 967 // for Android WebView to maintain backward compatibility.
988 // See crbug.com/526842 for details. 968 // See crbug.com/526842 for details.
989 #if defined(OS_ANDROID) 969 #if defined(OS_ANDROID)
990 if (GetContentClient()->UsingSynchronousCompositing()) { 970 if (GetContentClient()->UsingSynchronousCompositing()) {
991 channel_ = IPC::SyncChannel::Create( 971 channel_ = IPC::SyncChannel::Create(
992 this, io_task_runner.get(), &never_signaled_); 972 this, io_task_runner.get(), &never_signaled_);
993 } 973 }
994 #endif // OS_ANDROID 974 #endif // OS_ANDROID
995 if (!channel_) 975 if (!channel_)
996 channel_.reset(new IPC::ChannelProxy(this, io_task_runner.get())); 976 channel_.reset(new IPC::ChannelProxy(this, io_task_runner.get()));
997 #if USE_ATTACHMENT_BROKER
998 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
999 channel_.get(), io_task_runner);
1000 #endif
1001 channel_->Init(std::move(channel_factory), true /* create_pipe_now */); 977 channel_->Init(std::move(channel_factory), true /* create_pipe_now */);
1002 978
1003 // Note that Channel send is effectively paused and unpaused at various points 979 // Note that Channel send is effectively paused and unpaused at various points
1004 // during startup, and existing code relies on a fragile relative message 980 // during startup, and existing code relies on a fragile relative message
1005 // ordering resulting from some early messages being queued until process 981 // ordering resulting from some early messages being queued until process
1006 // launch while others are sent immediately. See https://goo.gl/REW75h for 982 // launch while others are sent immediately. See https://goo.gl/REW75h for
1007 // details. 983 // details.
1008 // 984 //
1009 // We acquire a few associated interface proxies here -- before the channel is 985 // We acquire a few associated interface proxies here -- before the channel is
1010 // paused -- to ensure that subsequent initialization messages on those 986 // paused -- to ensure that subsequent initialization messages on those
1011 // interfaces behave properly. Specifically, this avoids the risk of an 987 // interfaces behave properly. Specifically, this avoids the risk of an
1012 // interface being requested while the Channel is paused, which could 988 // interface being requested while the Channel is paused, which could
1013 // effectively and undesirably block the transmission of a subsequent message 989 // effectively and undesirably block the transmission of a subsequent message
1014 // on that interface while the Channel is unpaused. 990 // on that interface while the Channel is unpaused.
1015 // 991 //
1016 // See OnProcessLaunched() for some additional details of this somewhat 992 // See OnProcessLaunched() for some additional details of this somewhat
1017 // surprising behavior. 993 // surprising behavior.
1018 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); 994 channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
1019 channel_->GetRemoteAssociatedInterface(&renderer_interface_); 995 channel_->GetRemoteAssociatedInterface(&renderer_interface_);
1020 996
1021 // We start the Channel in a paused state. It will be briefly unpaused again 997 // We start the Channel in a paused state. It will be briefly unpaused again
1022 // in Init() if applicable, before process launch is initiated. 998 // in Init() if applicable, before process launch is initiated.
1023 channel_->Pause(); 999 channel_->Pause();
1024 } 1000 }
1025 1001
1026 void RenderProcessHostImpl::ResetChannelProxy() { 1002 void RenderProcessHostImpl::ResetChannelProxy() {
1027 if (!channel_) 1003 if (!channel_)
1028 return; 1004 return;
1029 1005
1030 #if USE_ATTACHMENT_BROKER
1031 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
1032 channel_.get());
1033 #endif
1034 channel_.reset(); 1006 channel_.reset();
1035 channel_connected_ = false; 1007 channel_connected_ = false;
1036 } 1008 }
1037 1009
1038 void RenderProcessHostImpl::CreateMessageFilters() { 1010 void RenderProcessHostImpl::CreateMessageFilters() {
1039 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1011 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1040 AddFilter(new ResourceSchedulerFilter(GetID())); 1012 AddFilter(new ResourceSchedulerFilter(GetID()));
1041 MediaInternals* media_internals = MediaInternals::GetInstance(); 1013 MediaInternals* media_internals = MediaInternals::GetInstance();
1042 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages 1014 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
1043 // from guests. 1015 // from guests.
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 bad_message::ReceivedBadMessage(render_process_id, 2983 bad_message::ReceivedBadMessage(render_process_id,
3012 bad_message::RPH_MOJO_PROCESS_ERROR); 2984 bad_message::RPH_MOJO_PROCESS_ERROR);
3013 } 2985 }
3014 2986
3015 void RenderProcessHostImpl::CreateURLLoaderFactory( 2987 void RenderProcessHostImpl::CreateURLLoaderFactory(
3016 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { 2988 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) {
3017 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request)); 2989 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request));
3018 } 2990 }
3019 2991
3020 } // namespace content 2992 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698