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

Unified Diff: content/common/child_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
Index: content/common/child_process_host_impl.cc
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index c64d2b71c3ffe8a5759cec1c98dbef314d6bc73b..b65a8cb7783e7b57b81f2b2297007f9532335833 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -121,16 +121,13 @@ void ChildProcessHostImpl::ForceShutdown() {
}
std::string ChildProcessHostImpl::CreateChannelMojo(
- const std::string& child_token) {
+ const mojo::edk::PendingProcessConnection& connection) {
DCHECK(channel_id_.empty());
- channel_id_ = mojo::edk::GenerateRandomToken();
- mojo::ScopedMessagePipeHandle host_handle =
- mojo::edk::CreateParentMessagePipe(channel_id_, child_token);
- channel_ = IPC::ChannelMojo::Create(std::move(host_handle),
- IPC::Channel::MODE_SERVER, this);
+ channel_ =
+ IPC::ChannelMojo::Create(connection.CreateMessagePipe(&channel_id_),
+ IPC::Channel::MODE_SERVER, this);
if (!channel_ || !InitChannel())
return std::string();
-
return channel_id_;
}

Powered by Google App Engine
This is Rietveld 408576698