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

Unified Diff: remoting/host/win/unprivileged_process_delegate.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 | « mojo/edk/test/multiprocess_test_helper.cc ('k') | remoting/host/win/wts_session_process_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/win/unprivileged_process_delegate.cc
diff --git a/remoting/host/win/unprivileged_process_delegate.cc b/remoting/host/win/unprivileged_process_delegate.cc
index c9f00415107d6b597d39c84d6c03217fd19a321b..5c0a6b54d8703ca351b8c0460b605d9605b3a1e7 100644
--- a/remoting/host/win/unprivileged_process_delegate.cc
+++ b/remoting/host/win/unprivileged_process_delegate.cc
@@ -26,6 +26,7 @@
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message.h"
#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/pending_process_connection.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "remoting/base/typed_buffer.h"
#include "remoting/host/switches.h"
@@ -283,13 +284,10 @@ void UnprivilegedProcessDelegate::LaunchProcess(
return;
}
- const std::string mojo_child_token = mojo::edk::GenerateRandomToken();
- const std::string mojo_message_pipe_token = mojo::edk::GenerateRandomToken();
-
+ mojo::edk::PendingProcessConnection process;
+ std::string mojo_message_pipe_token;
std::unique_ptr<IPC::ChannelProxy> server = IPC::ChannelProxy::Create(
- mojo::edk::CreateParentMessagePipe(mojo_message_pipe_token,
- mojo_child_token)
- .release(),
+ process.CreateMessagePipe(&mojo_message_pipe_token).release(),
IPC::Channel::MODE_SERVER, this, io_task_runner_);
base::CommandLine command_line(target_command_->argv());
command_line.AppendSwitchASCII(kMojoPipeToken, mojo_message_pipe_token);
@@ -310,12 +308,10 @@ void UnprivilegedProcessDelegate::LaunchProcess(
token.Get(), &process_attributes, &thread_attributes,
handles_to_inherit, /* creation_flags= */ 0,
/* thread_attributes= */ nullptr, &worker_process, &worker_thread)) {
- mojo::edk::ChildProcessLaunchFailed(mojo_child_token);
ReportFatalError();
return;
}
- mojo::edk::ChildProcessLaunched(
- worker_process.Get(), mojo_channel.PassServerHandle(), mojo_child_token);
+ process.Connect(worker_process.Get(), mojo_channel.PassServerHandle());
channel_ = std::move(server);
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper.cc ('k') | remoting/host/win/wts_session_process_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698