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

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: Created 5 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
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 storage_partition_impl_->GetPath())); 544 storage_partition_impl_->GetPath()));
543 } 545 }
544 subscribe_uniform_enabled_ = 546 subscribe_uniform_enabled_ =
545 base::CommandLine::ForCurrentProcess()->HasSwitch( 547 base::CommandLine::ForCurrentProcess()->HasSwitch(
546 switches::kEnableSubscribeUniformExtension); 548 switches::kEnableSubscribeUniformExtension);
547 549
548 #if defined(OS_MACOSX) 550 #if defined(OS_MACOSX)
549 if (BootstrapSandboxManager::ShouldEnable()) 551 if (BootstrapSandboxManager::ShouldEnable())
550 AddObserver(BootstrapSandboxManager::GetInstance()); 552 AddObserver(BootstrapSandboxManager::GetInstance());
551 #endif 553 #endif
554
555 #if USE_ATTACHMENT_BROKER
556 // Construct the privileged attachment broker early in the life cycle of a
557 // child process. This ensures that when a test is being run in one of the
558 // single process modes, the global attachment broker is the privileged
559 // attachment broker, rather than an unprivileged attachment broker.
560 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
561 #endif
552 } 562 }
553 563
554 // static 564 // static
555 void RenderProcessHostImpl::ShutDownInProcessRenderer() { 565 void RenderProcessHostImpl::ShutDownInProcessRenderer() {
556 DCHECK(g_run_renderer_in_process_); 566 DCHECK(g_run_renderer_in_process_);
557 567
558 switch (g_all_hosts.Pointer()->size()) { 568 switch (g_all_hosts.Pointer()->size()) {
559 case 0: 569 case 0:
560 return; 570 return;
561 case 1: { 571 case 1: {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 if (renderer_path.empty()) 654 if (renderer_path.empty())
645 return false; 655 return false;
646 656
647 channel_connected_ = false; 657 channel_connected_ = false;
648 sent_render_process_ready_ = false; 658 sent_render_process_ready_ = false;
649 659
650 // Setup the IPC channel. 660 // Setup the IPC channel.
651 const std::string channel_id = 661 const std::string channel_id =
652 IPC::Channel::GenerateVerifiedChannelID(std::string()); 662 IPC::Channel::GenerateVerifiedChannelID(std::string());
653 channel_ = CreateChannelProxy(channel_id); 663 channel_ = CreateChannelProxy(channel_id);
664 #if USE_ATTACHMENT_BROKER
665 GetAttachmentBroker()->RegisterCommunicationChannel(channel_.get());
666 #endif
654 667
655 // Setup the Mojo channel. 668 // Setup the Mojo channel.
656 mojo_application_host_->Init(); 669 mojo_application_host_->Init();
657 670
658 // Call the embedder first so that their IPC filters have priority. 671 // Call the embedder first so that their IPC filters have priority.
659 GetContentClient()->browser()->RenderProcessWillLaunch(this); 672 GetContentClient()->browser()->RenderProcessWillLaunch(this);
660 673
661 CreateMessageFilters(); 674 CreateMessageFilters();
662 RegisterMojoServices(); 675 RegisterMojoServices();
663 676
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 RenderProcessHostDestroyed(this)); 1737 RenderProcessHostDestroyed(this));
1725 NotificationService::current()->Notify( 1738 NotificationService::current()->Notify(
1726 NOTIFICATION_RENDERER_PROCESS_TERMINATED, 1739 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
1727 Source<RenderProcessHost>(this), NotificationService::NoDetails()); 1740 Source<RenderProcessHost>(this), NotificationService::NoDetails());
1728 1741
1729 #ifndef NDEBUG 1742 #ifndef NDEBUG
1730 is_self_deleted_ = true; 1743 is_self_deleted_ = true;
1731 #endif 1744 #endif
1732 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1745 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1733 deleting_soon_ = true; 1746 deleting_soon_ = true;
1747
1748 #if USE_ATTACHMENT_BROKER
1749 GetAttachmentBroker()->DeregisterCommunicationChannel(channel_.get());
1750 #endif
1751
1734 // It's important not to wait for the DeleteTask to delete the channel 1752 // 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 1753 // 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 1754 // rest of the objects attached to this RenderProcessHost start going
1737 // away first, since deleting the channel proxy will post a 1755 // away first, since deleting the channel proxy will post a
1738 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1756 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1739 channel_.reset(); 1757 channel_.reset();
1740 1758
1741 // The following members should be cleared in ProcessDied() as well! 1759 // The following members should be cleared in ProcessDied() as well!
1742 gpu_message_filter_ = NULL; 1760 gpu_message_filter_ = NULL;
1743 message_port_message_filter_ = NULL; 1761 message_port_message_filter_ = NULL;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 void RenderProcessHostImpl::GetAudioOutputControllers( 2574 void RenderProcessHostImpl::GetAudioOutputControllers(
2557 const GetAudioOutputControllersCallback& callback) const { 2575 const GetAudioOutputControllersCallback& callback) const {
2558 audio_renderer_host()->GetOutputControllers(callback); 2576 audio_renderer_host()->GetOutputControllers(callback);
2559 } 2577 }
2560 2578
2561 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { 2579 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() {
2562 return bluetooth_dispatcher_host_.get(); 2580 return bluetooth_dispatcher_host_.get();
2563 } 2581 }
2564 2582
2565 } // namespace content 2583 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/child_process_host_impl.cc » ('j') | ipc/attachment_broker_privileged.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698