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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 9180fdb96308535a63953ba4822c2453529809f6..52584714d713e9298462fd5009e3c8a59abb328c 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -153,6 +153,8 @@
#include "gpu/command_buffer/client/gpu_switches.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/gpu_switches.h"
+#include "ipc/attachment_broker.h"
+#include "ipc/attachment_broker_privileged.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_switches.h"
@@ -190,6 +192,7 @@
#if defined(OS_MACOSX) && !defined(OS_IOS)
#include "content/browser/bootstrap_sandbox_manager_mac.h"
#include "content/browser/browser_io_surface_manager_mac.h"
+#include "content/browser/mach_broker_mac.h"
#endif
#if defined(USE_OZONE)
@@ -549,6 +552,19 @@ RenderProcessHostImpl::RenderProcessHostImpl(
if (BootstrapSandboxManager::ShouldEnable())
AddObserver(BootstrapSandboxManager::GetInstance());
#endif
+
+#if USE_ATTACHMENT_BROKER
+ // Construct the privileged attachment broker early in the life cycle of a
+ // render process. This ensures that when a test is being run in one of the
+ // single process modes, the global attachment broker is the privileged
+ // attachment broker, rather than an unprivileged attachment broker.
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
+ MachBroker::GetInstance());
+#else
+ IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+#endif // USE_ATTACHMENT_BROKER
}
// static
@@ -651,6 +667,10 @@ bool RenderProcessHostImpl::Init() {
const std::string channel_id =
IPC::Channel::GenerateVerifiedChannelID(std::string());
channel_ = CreateChannelProxy(channel_id);
+#if USE_ATTACHMENT_BROKER
+ IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
+ channel_.get());
+#endif
// Setup the Mojo channel.
mojo_application_host_->Init();
@@ -1731,6 +1751,12 @@ void RenderProcessHostImpl::Cleanup() {
#endif
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
deleting_soon_ = true;
+
+#if USE_ATTACHMENT_BROKER
+ IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
+ channel_.get());
+#endif
+
// It's important not to wait for the DeleteTask to delete the channel
// proxy. Kill it off now. That way, in case the profile is going away, the
// rest of the objects attached to this RenderProcessHost start going
« 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