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

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

Issue 1414603003: ipc: Move AttachmentBrokerPrivileged singleton logic into ipc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor formatting. Created 5 years, 2 months 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
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 #include "content/public/common/resource_type.h" 146 #include "content/public/common/resource_type.h"
147 #include "content/public/common/result_codes.h" 147 #include "content/public/common/result_codes.h"
148 #include "content/public/common/sandboxed_process_launcher_delegate.h" 148 #include "content/public/common/sandboxed_process_launcher_delegate.h"
149 #include "content/public/common/url_constants.h" 149 #include "content/public/common/url_constants.h"
150 #include "device/battery/battery_monitor_impl.h" 150 #include "device/battery/battery_monitor_impl.h"
151 #include "device/vibration/vibration_manager_impl.h" 151 #include "device/vibration/vibration_manager_impl.h"
152 #include "gpu/GLES2/gl2extchromium.h" 152 #include "gpu/GLES2/gl2extchromium.h"
153 #include "gpu/command_buffer/client/gpu_switches.h" 153 #include "gpu/command_buffer/client/gpu_switches.h"
154 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 154 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
155 #include "gpu/command_buffer/service/gpu_switches.h" 155 #include "gpu/command_buffer/service/gpu_switches.h"
156 #include "ipc/attachment_broker.h"
157 #include "ipc/attachment_broker_privileged.h"
156 #include "ipc/ipc_channel.h" 158 #include "ipc/ipc_channel.h"
157 #include "ipc/ipc_logging.h" 159 #include "ipc/ipc_logging.h"
158 #include "ipc/ipc_switches.h" 160 #include "ipc/ipc_switches.h"
159 #include "ipc/mojo/ipc_channel_mojo.h" 161 #include "ipc/mojo/ipc_channel_mojo.h"
160 #include "media/base/media_switches.h" 162 #include "media/base/media_switches.h"
161 #include "net/url_request/url_request_context_getter.h" 163 #include "net/url_request/url_request_context_getter.h"
162 #include "ppapi/shared_impl/ppapi_switches.h" 164 #include "ppapi/shared_impl/ppapi_switches.h"
163 #include "storage/browser/fileapi/sandbox_file_system_backend.h" 165 #include "storage/browser/fileapi/sandbox_file_system_backend.h"
164 #include "third_party/icu/source/common/unicode/unistr.h" 166 #include "third_party/icu/source/common/unicode/unistr.h"
165 #include "third_party/icu/source/i18n/unicode/timezone.h" 167 #include "third_party/icu/source/i18n/unicode/timezone.h"
(...skipping 17 matching lines...) Expand all
183 #include "base/win/windows_version.h" 185 #include "base/win/windows_version.h"
184 #include "content/common/font_cache_dispatcher_win.h" 186 #include "content/common/font_cache_dispatcher_win.h"
185 #include "content/common/sandbox_win.h" 187 #include "content/common/sandbox_win.h"
186 #include "sandbox/win/src/sandbox_policy.h" 188 #include "sandbox/win/src/sandbox_policy.h"
187 #include "ui/gfx/win/dpi.h" 189 #include "ui/gfx/win/dpi.h"
188 #endif 190 #endif
189 191
190 #if defined(OS_MACOSX) && !defined(OS_IOS) 192 #if defined(OS_MACOSX) && !defined(OS_IOS)
191 #include "content/browser/bootstrap_sandbox_manager_mac.h" 193 #include "content/browser/bootstrap_sandbox_manager_mac.h"
192 #include "content/browser/browser_io_surface_manager_mac.h" 194 #include "content/browser/browser_io_surface_manager_mac.h"
195 #include "content/browser/mach_broker_mac.h"
193 #endif 196 #endif
194 197
195 #if defined(USE_OZONE) 198 #if defined(USE_OZONE)
196 #include "ui/ozone/public/client_native_pixmap_factory.h" 199 #include "ui/ozone/public/client_native_pixmap_factory.h"
197 #include "ui/ozone/public/ozone_platform.h" 200 #include "ui/ozone/public/ozone_platform.h"
198 #include "ui/ozone/public/ozone_switches.h" 201 #include "ui/ozone/public/ozone_switches.h"
199 #endif 202 #endif
200 203
201 #if defined(ENABLE_BROWSER_CDMS) 204 #if defined(ENABLE_BROWSER_CDMS)
202 #include "content/browser/media/cdm/browser_cdm_manager.h" 205 #include "content/browser/media/cdm/browser_cdm_manager.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 storage_partition_impl_->GetPath())); 545 storage_partition_impl_->GetPath()));
543 } 546 }
544 subscribe_uniform_enabled_ = 547 subscribe_uniform_enabled_ =
545 base::CommandLine::ForCurrentProcess()->HasSwitch( 548 base::CommandLine::ForCurrentProcess()->HasSwitch(
546 switches::kEnableSubscribeUniformExtension); 549 switches::kEnableSubscribeUniformExtension);
547 550
548 #if defined(OS_MACOSX) 551 #if defined(OS_MACOSX)
549 if (BootstrapSandboxManager::ShouldEnable()) 552 if (BootstrapSandboxManager::ShouldEnable())
550 AddObserver(BootstrapSandboxManager::GetInstance()); 553 AddObserver(BootstrapSandboxManager::GetInstance());
551 #endif 554 #endif
555
556 #if USE_ATTACHMENT_BROKER
557 // Construct the privileged attachment broker early in the life cycle of a
558 // render process. This ensures that when a test is being run in one of the
559 // single process modes, the global attachment broker is the privileged
560 // attachment broker, rather than an unprivileged attachment broker.
561 #if defined(OS_MACOSX) && !defined(OS_IOS)
562 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
563 MachBroker::GetInstance());
564 #else
565 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
566 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
567 #endif // USE_ATTACHMENT_BROKER
552 } 568 }
553 569
554 // static 570 // static
555 void RenderProcessHostImpl::ShutDownInProcessRenderer() { 571 void RenderProcessHostImpl::ShutDownInProcessRenderer() {
556 DCHECK(g_run_renderer_in_process_); 572 DCHECK(g_run_renderer_in_process_);
557 573
558 switch (g_all_hosts.Pointer()->size()) { 574 switch (g_all_hosts.Pointer()->size()) {
559 case 0: 575 case 0:
560 return; 576 return;
561 case 1: { 577 case 1: {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 if (renderer_path.empty()) 660 if (renderer_path.empty())
645 return false; 661 return false;
646 662
647 channel_connected_ = false; 663 channel_connected_ = false;
648 sent_render_process_ready_ = false; 664 sent_render_process_ready_ = false;
649 665
650 // Setup the IPC channel. 666 // Setup the IPC channel.
651 const std::string channel_id = 667 const std::string channel_id =
652 IPC::Channel::GenerateVerifiedChannelID(std::string()); 668 IPC::Channel::GenerateVerifiedChannelID(std::string());
653 channel_ = CreateChannelProxy(channel_id); 669 channel_ = CreateChannelProxy(channel_id);
670 #if USE_ATTACHMENT_BROKER
671 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
672 channel_.get());
673 #endif
654 674
655 // Setup the Mojo channel. 675 // Setup the Mojo channel.
656 mojo_application_host_->Init(); 676 mojo_application_host_->Init();
657 677
658 // Call the embedder first so that their IPC filters have priority. 678 // Call the embedder first so that their IPC filters have priority.
659 GetContentClient()->browser()->RenderProcessWillLaunch(this); 679 GetContentClient()->browser()->RenderProcessWillLaunch(this);
660 680
661 CreateMessageFilters(); 681 CreateMessageFilters();
662 RegisterMojoServices(); 682 RegisterMojoServices();
663 683
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 RenderProcessHostDestroyed(this)); 1744 RenderProcessHostDestroyed(this));
1725 NotificationService::current()->Notify( 1745 NotificationService::current()->Notify(
1726 NOTIFICATION_RENDERER_PROCESS_TERMINATED, 1746 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
1727 Source<RenderProcessHost>(this), NotificationService::NoDetails()); 1747 Source<RenderProcessHost>(this), NotificationService::NoDetails());
1728 1748
1729 #ifndef NDEBUG 1749 #ifndef NDEBUG
1730 is_self_deleted_ = true; 1750 is_self_deleted_ = true;
1731 #endif 1751 #endif
1732 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1752 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1733 deleting_soon_ = true; 1753 deleting_soon_ = true;
1754
1755 #if USE_ATTACHMENT_BROKER
1756 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
1757 channel_.get());
1758 #endif
1759
1734 // It's important not to wait for the DeleteTask to delete the channel 1760 // It's important not to wait for the DeleteTask to delete the channel
1735 // proxy. Kill it off now. That way, in case the profile is going away, the 1761 // proxy. Kill it off now. That way, in case the profile is going away, the
1736 // rest of the objects attached to this RenderProcessHost start going 1762 // rest of the objects attached to this RenderProcessHost start going
1737 // away first, since deleting the channel proxy will post a 1763 // away first, since deleting the channel proxy will post a
1738 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1764 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1739 channel_.reset(); 1765 channel_.reset();
1740 1766
1741 // The following members should be cleared in ProcessDied() as well! 1767 // The following members should be cleared in ProcessDied() as well!
1742 gpu_message_filter_ = NULL; 1768 gpu_message_filter_ = NULL;
1743 message_port_message_filter_ = NULL; 1769 message_port_message_filter_ = NULL;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 void RenderProcessHostImpl::GetAudioOutputControllers( 2582 void RenderProcessHostImpl::GetAudioOutputControllers(
2557 const GetAudioOutputControllersCallback& callback) const { 2583 const GetAudioOutputControllersCallback& callback) const {
2558 audio_renderer_host()->GetOutputControllers(callback); 2584 audio_renderer_host()->GetOutputControllers(callback);
2559 } 2585 }
2560 2586
2561 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { 2587 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() {
2562 return bluetooth_dispatcher_host_.get(); 2588 return bluetooth_dispatcher_host_.get();
2563 } 2589 }
2564 2590
2565 } // namespace content 2591 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698