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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) Created 4 years, 8 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 | « components/nacl/loader/nacl_listener.cc ('k') | content/child/child_thread_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 4b16440bcf874afb8f1f9ce748353d2e15527f13..4061947e26511f2455ba2c8e414f46e0862b9dea 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -723,11 +723,6 @@ 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(), content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::IO));
-#endif
// Call the embedder first so that their IPC filters have priority.
GetContentClient()->browser()->RenderProcessWillLaunch(this);
@@ -823,9 +818,15 @@ std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
}
#endif // OS_ANDROID
- return IPC::ChannelProxy::Create(
- IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this,
- runner.get());
+ std::unique_ptr<IPC::ChannelProxy> channel(
+ new IPC::ChannelProxy(this, runner.get()));
+#if USE_ATTACHMENT_BROKER
+ IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
+ channel.get(), content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::IO));
+#endif
+ channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true);
+ return channel;
}
// Do NOT expand ifdef or run time condition checks here! See comment above.
@@ -836,8 +837,15 @@ std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
}
#endif // OS_ANDROID
- return IPC::ChannelProxy::Create(channel_id, IPC::Channel::MODE_SERVER, this,
- runner.get());
+ std::unique_ptr<IPC::ChannelProxy> channel(
+ new IPC::ChannelProxy(this, runner.get()));
+#if USE_ATTACHMENT_BROKER
+ IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
+ channel.get(), content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::IO));
+#endif
+ channel->Init(channel_id, IPC::Channel::MODE_SERVER, true);
+ return channel;
}
void RenderProcessHostImpl::CreateMessageFilters() {
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698