Index: mojo/runner/host/child_process_host.cc |
diff --git a/mojo/runner/host/child_process_host.cc b/mojo/runner/host/child_process_host.cc |
index f8777db58e3ff2c64cd5062f8a57815f1e81a59d..06368eba810662ab589e9c1b367c9b78444e48cb 100644 |
--- a/mojo/runner/host/child_process_host.cc |
+++ b/mojo/runner/host/child_process_host.cc |
@@ -18,10 +18,10 @@ |
#include "base/process/launch.h" |
#include "base/task_runner.h" |
#include "base/thread_task_runner_handle.h" |
+#include "mojo/edk/embedder/embedder.h" |
#include "mojo/public/cpp/bindings/interface_ptr_info.h" |
#include "mojo/public/cpp/system/core.h" |
#include "mojo/runner/host/switches.h" |
-#include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
#if defined(OS_LINUX) && !defined(OS_ANDROID) |
#include "sandbox/linux/services/namespace_sandbox.h" |
@@ -40,22 +40,17 @@ ChildProcessHost::ChildProcessHost(base::TaskRunner* launch_process_runner, |
: launch_process_runner_(launch_process_runner), |
start_sandboxed_(start_sandboxed), |
app_path_(app_path), |
- channel_info_(nullptr), |
start_child_process_event_(false, false), |
weak_factory_(this) { |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) |
- serializer_platform_channel_pair_.reset(new edk::PlatformChannelPair(true)); |
+ serializer_platform_channel_pair_.reset(new edk::PlatformChannelPair(true)); |
- child_message_pipe_ = embedder::CreateChannel( |
- platform_channel_pair_.PassServerHandle(), |
- base::Bind(&ChildProcessHost::DidCreateChannel, base::Unretained(this)), |
- base::ThreadTaskRunnerHandle::Get()); |
+ child_message_pipe_ = edk::CreateMessagePipe( |
+ platform_channel_pair_.PassServerHandle()); |
} |
ChildProcessHost::ChildProcessHost(ScopedHandle channel) |
: launch_process_runner_(nullptr), |
start_sandboxed_(false), |
- channel_info_(nullptr), |
start_child_process_event_(false, false), |
weak_factory_(this) { |
CHECK(channel.is_valid()); |
@@ -73,20 +68,18 @@ void ChildProcessHost::Start( |
DCHECK(!child_process_.IsValid()); |
DCHECK(child_message_pipe_.is_valid()); |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) { |
- std::string client_handle_as_string = |
- serializer_platform_channel_pair_ |
- ->PrepareToPassClientHandleToChildProcessAsString( |
- &handle_passing_info_); |
- // We can't send the MP for the token serializer implementation as a |
- // platform handle, because that would require the other side to use the |
- // token initializer itself! So instead we send it as a string. |
- MojoResult rv = MojoWriteMessage( |
- child_message_pipe_.get().value(), client_handle_as_string.c_str(), |
- static_cast<uint32_t>(client_handle_as_string.size()), nullptr, 0, |
- MOJO_WRITE_MESSAGE_FLAG_NONE); |
- DCHECK_EQ(rv, MOJO_RESULT_OK); |
- } |
+ std::string client_handle_as_string = |
+ serializer_platform_channel_pair_ |
+ ->PrepareToPassClientHandleToChildProcessAsString( |
+ &handle_passing_info_); |
+ // We can't send the MP for the token serializer implementation as a |
+ // platform handle, because that would require the other side to use the |
+ // token initializer itself! So instead we send it as a string. |
+ MojoResult rv = MojoWriteMessage( |
+ child_message_pipe_.get().value(), client_handle_as_string.c_str(), |
+ static_cast<uint32_t>(client_handle_as_string.size()), nullptr, 0, |
+ MOJO_WRITE_MESSAGE_FLAG_NONE); |
+ DCHECK_EQ(rv, MOJO_RESULT_OK); |
controller_.Bind( |
InterfacePtrInfo<ChildController>(std::move(child_message_pipe_), 0u)); |
@@ -212,11 +205,9 @@ void ChildProcessHost::DoLaunch() { |
platform_channel_pair_.ChildProcessLaunched(); |
if (serializer_platform_channel_pair_.get()) { |
serializer_platform_channel_pair_->ChildProcessLaunched(); |
- mojo::embedder::ChildProcessLaunched( |
+ mojo::edk::ChildProcessLaunched( |
child_process_.Handle(), |
- mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle( |
- serializer_platform_channel_pair_->PassServerHandle().release(). |
- handle))); |
+ serializer_platform_channel_pair_->PassServerHandle()); |
} |
} |
start_child_process_event_.Signal(); |
@@ -230,13 +221,5 @@ void ChildProcessHost::AppCompleted(int32_t result) { |
} |
} |
-void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { |
- DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; |
- |
- DCHECK(channel_info || |
- base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")); |
- channel_info_ = channel_info; |
-} |
- |
} // namespace runner |
} // namespace mojo |