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

Unified Diff: content/child/child_thread_impl.cc

Issue 1292263003: ipc: Use a global for the process's attachment broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_message2
Patch Set: Comments from avi. Created 5 years, 3 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/child/child_thread_impl.h ('k') | content/child/npapi/np_channel_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 08c2075f7faef7542f94dc26911e6a202ab93eda..bfb1f3a21bf3d4fe20fd40242e37debfd6673457 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -357,15 +357,14 @@ void ChildThreadImpl::ConnectChannel(bool use_mojo_channel) {
VLOG(1) << "Mojo is enabled on child";
scoped_refptr<base::SequencedTaskRunner> io_task_runner = GetIOTaskRunner();
DCHECK(io_task_runner);
- channel_->Init(IPC::ChannelMojo::CreateClientFactory(
- io_task_runner, channel_name_, attachment_broker_.get()),
- create_pipe_now);
+ channel_->Init(
+ IPC::ChannelMojo::CreateClientFactory(io_task_runner, channel_name_),
+ create_pipe_now);
return;
}
VLOG(1) << "Mojo is disabled on child";
- channel_->Init(channel_name_, IPC::Channel::MODE_CLIENT, create_pipe_now,
- attachment_broker_.get());
+ channel_->Init(channel_name_, IPC::Channel::MODE_CLIENT, create_pipe_now);
}
void ChildThreadImpl::Init(const Options& options) {
@@ -380,6 +379,16 @@ void ChildThreadImpl::Init(const Options& options) {
// the logger, and the logger does not like being created on the IO thread.
IPC::Logging::GetInstance();
#endif
+
+#if defined(OS_WIN)
+ // The only reason a global would already exist is if the thread is being run
+ // in the browser process because of a command line switch.
+ if (!IPC::AttachmentBroker::GetGlobal()) {
+ attachment_broker_.reset(new IPC::AttachmentBrokerUnprivilegedWin());
+ IPC::AttachmentBroker::SetGlobal(attachment_broker_.get());
+ }
+#endif
+
channel_ =
IPC::SyncChannel::Create(this, ChildProcess::current()->io_task_runner(),
ChildProcess::current()->GetShutDownEvent());
@@ -388,10 +397,6 @@ void ChildThreadImpl::Init(const Options& options) {
IPC::Logging::GetInstance()->SetIPCSender(this);
#endif
-#if defined(OS_WIN)
- attachment_broker_.reset(new IPC::AttachmentBrokerUnprivilegedWin());
-#endif
-
mojo_application_.reset(new MojoApplication(GetIOTaskRunner()));
sync_message_filter_ = channel_->CreateSyncMessageFilter();
@@ -565,10 +570,6 @@ void ChildThreadImpl::ReleaseCachedFonts() {
}
#endif
-IPC::AttachmentBroker* ChildThreadImpl::GetAttachmentBroker() {
- return attachment_broker_.get();
-}
-
MessageRouter* ChildThreadImpl::GetRouter() {
DCHECK(base::MessageLoop::current() == message_loop());
return &router_;
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/npapi/np_channel_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698