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

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

Issue 2680973006: Mojo EDK: Add safe process connection API (Closed)
Patch Set: . Created 3 years, 10 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/renderer_host/render_process_host_impl.h ('k') | content/common/child_process_host_impl.h » ('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 6f881599873ec3bd38915dbb7990877a56fedb7a..8e4112c0d518fa960ac60fd463ab47d3af8cc0e7 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -830,6 +830,7 @@ bool RenderProcessHostImpl::Init() {
// null, so we re-initialize it here.
if (!channel_)
InitializeChannelProxy();
+ DCHECK(pending_connection_);
// Unpause the Channel briefly. This will be paused again below if we launch a
// real child process. Note that messages may be sent in the short window
@@ -910,7 +911,7 @@ bool RenderProcessHostImpl::Init() {
// at this stage.
child_process_launcher_.reset(new ChildProcessLauncher(
base::MakeUnique<RendererSandboxedProcessLauncherDelegate>(),
- std::move(cmd_line), GetID(), this, child_token_,
+ std::move(cmd_line), GetID(), this, std::move(pending_connection_),
base::Bind(&RenderProcessHostImpl::OnMojoError, id_)));
channel_->Pause();
@@ -933,9 +934,6 @@ void RenderProcessHostImpl::EnableSendQueue() {
}
void RenderProcessHostImpl::InitializeChannelProxy() {
- // Generate a token used to identify the new child process.
- child_token_ = mojo::edk::GenerateRandomToken();
-
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
@@ -960,10 +958,11 @@ void RenderProcessHostImpl::InitializeChannelProxy() {
}
// Establish a ServiceManager connection for the new render service instance.
+ pending_connection_.reset(new mojo::edk::PendingProcessConnection);
child_connection_.reset(new ChildConnection(
mojom::kRendererServiceName,
- base::StringPrintf("%d_%d", id_, instance_id_++), child_token_, connector,
- io_task_runner));
+ base::StringPrintf("%d_%d", id_, instance_id_++),
+ pending_connection_.get(), connector, io_task_runner));
// Send an interface request to bootstrap the IPC::Channel. Note that this
// request will happily sit on the pipe until the process is launched and
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/common/child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698