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 |