| Index: remoting/host/win/wts_session_process_delegate.cc
|
| diff --git a/remoting/host/win/wts_session_process_delegate.cc b/remoting/host/win/wts_session_process_delegate.cc
|
| index 635bd04b68dadb4923ac4a836a2add44aba5847e..c665a59c4571a3ce7ecce4adc4a9a623fe2d7d36 100644
|
| --- a/remoting/host/win/wts_session_process_delegate.cc
|
| +++ b/remoting/host/win/wts_session_process_delegate.cc
|
| @@ -7,6 +7,7 @@
|
|
|
| #include "remoting/host/win/wts_session_process_delegate.h"
|
|
|
| +#include <memory>
|
| #include <utility>
|
|
|
| #include "base/bind.h"
|
| @@ -27,6 +28,7 @@
|
| #include "ipc/ipc_message.h"
|
| #include "mojo/edk/embedder/embedder.h"
|
| #include "mojo/edk/embedder/named_platform_channel_pair.h"
|
| +#include "mojo/edk/embedder/pending_process_connection.h"
|
| #include "mojo/edk/embedder/platform_channel_pair.h"
|
| #include "mojo/edk/embedder/platform_handle_utils.h"
|
| #include "mojo/edk/embedder/scoped_platform_handle.h"
|
| @@ -155,8 +157,8 @@ class WtsSessionProcessDelegate::Core
|
| // Tracks the id of the worker process.
|
| base::ProcessId worker_process_pid_ = base::kNullProcessId;
|
|
|
| - // The mojo child token for the process being launched.
|
| - std::string mojo_child_token_;
|
| + // The pending process connection for the process being launched.
|
| + std::unique_ptr<mojo::edk::PendingProcessConnection> process_connection_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Core);
|
| };
|
| @@ -257,10 +259,7 @@ void WtsSessionProcessDelegate::Core::CloseChannel() {
|
| channel_.reset();
|
| elevated_server_handle_.reset();
|
| elevated_launcher_pid_ = base::kNullProcessId;
|
| - if (!mojo_child_token_.empty()) {
|
| - mojo::edk::ChildProcessLaunchFailed(mojo_child_token_);
|
| - mojo_child_token_.clear();
|
| - }
|
| + process_connection_.reset();
|
| }
|
|
|
| void WtsSessionProcessDelegate::Core::KillProcess() {
|
| @@ -391,14 +390,12 @@ void WtsSessionProcessDelegate::Core::DoLaunchProcess() {
|
| target_command_->GetProgram());
|
| }
|
|
|
| - const std::string mojo_message_pipe_token = mojo::edk::GenerateRandomToken();
|
| - mojo_child_token_ = mojo::edk::GenerateRandomToken();
|
| + std::string mojo_pipe_token;
|
| + process_connection_ = base::MakeUnique<mojo::edk::PendingProcessConnection>();
|
| std::unique_ptr<IPC::ChannelProxy> channel = IPC::ChannelProxy::Create(
|
| - mojo::edk::CreateParentMessagePipe(mojo_message_pipe_token,
|
| - mojo_child_token_)
|
| - .release(),
|
| + process_connection_->CreateMessagePipe(&mojo_pipe_token).release(),
|
| IPC::Channel::MODE_SERVER, this, io_task_runner_);
|
| - command_line.AppendSwitchASCII(kMojoPipeToken, mojo_message_pipe_token);
|
| + command_line.AppendSwitchASCII(kMojoPipeToken, mojo_pipe_token);
|
|
|
| std::unique_ptr<mojo::edk::PlatformChannelPair> normal_mojo_channel;
|
| std::unique_ptr<mojo::edk::NamedPlatformChannelPair> elevated_mojo_channel;
|
| @@ -558,10 +555,8 @@ void WtsSessionProcessDelegate::Core::ReportProcessLaunched(
|
| DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
| DCHECK(!worker_process_.IsValid());
|
|
|
| - mojo::edk::ChildProcessLaunched(worker_process.Get(),
|
| - std::move(server_handle),
|
| - mojo_child_token_);
|
| - mojo_child_token_.clear();
|
| + process_connection_->Connect(worker_process.Get(), std::move(server_handle));
|
| + process_connection_.reset();
|
| worker_process_ = std::move(worker_process);
|
|
|
| // Report a handle that can be used to wait for the worker process completion,
|
|
|