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

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: 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 | « no previous file | content/common/child_process_host_impl.cc » ('j') | ipc/attachment_broker_privileged.cc » ('J')
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..8de17e409548e7e74950ca875119f4fe51a39895 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"
@@ -549,6 +551,14 @@ 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
+ // child 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.
+ IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
+#endif
}
// static
@@ -651,6 +661,9 @@ bool RenderProcessHostImpl::Init() {
const std::string channel_id =
IPC::Channel::GenerateVerifiedChannelID(std::string());
channel_ = CreateChannelProxy(channel_id);
+#if USE_ATTACHMENT_BROKER
+ GetAttachmentBroker()->RegisterCommunicationChannel(channel_.get());
+#endif
// Setup the Mojo channel.
mojo_application_host_->Init();
@@ -1731,6 +1744,11 @@ void RenderProcessHostImpl::Cleanup() {
#endif
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
deleting_soon_ = true;
+
+#if USE_ATTACHMENT_BROKER
+ GetAttachmentBroker()->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 | « 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