| Index: mojo/runner/child/runner_connection.cc
|
| diff --git a/mojo/runner/child/runner_connection.cc b/mojo/runner/child/runner_connection.cc
|
| index 33f530ddcd15104b2a6d49ce7e0534fce4a48d92..d5996f1f3ca4d6c990143226dd942fea5738f7ad 100644
|
| --- a/mojo/runner/child/runner_connection.cc
|
| +++ b/mojo/runner/child/runner_connection.cc
|
| @@ -19,19 +19,15 @@
|
| #include "base/threading/thread_checker.h"
|
| #include "mojo/edk/embedder/embedder.h"
|
| #include "mojo/edk/embedder/platform_channel_pair.h"
|
| +#include "mojo/edk/embedder/scoped_platform_handle.h"
|
| #include "mojo/message_pump/message_pump_mojo.h"
|
| #include "mojo/public/cpp/bindings/binding.h"
|
| #include "mojo/runner/child/child_controller.mojom.h"
|
| -#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
|
| -#include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
|
| -#include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
|
|
|
| namespace mojo {
|
| namespace runner {
|
| namespace {
|
|
|
| -void DidCreateChannel(embedder::ChannelInfo* channel_info) {}
|
| -
|
| // Blocks a thread until another thread unblocks it, at which point it unblocks
|
| // and runs a closure provided by that thread.
|
| class Blocker {
|
| @@ -191,7 +187,6 @@ class ChildControllerImpl : public ChildController {
|
| : connection_(connection),
|
| callback_(callback),
|
| unblocker_(unblocker),
|
| - channel_info_(nullptr),
|
| binding_(this) {}
|
|
|
| static void ReturnApplicationRequestOnMainThread(
|
| @@ -206,7 +201,6 @@ class ChildControllerImpl : public ChildController {
|
| Blocker::Unblocker unblocker_;
|
| StartAppCallback on_app_complete_;
|
|
|
| - embedder::ChannelInfo* channel_info_;
|
| Binding<ChildController> binding_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ChildControllerImpl);
|
| @@ -218,45 +212,37 @@ bool RunnerConnectionImpl::WaitForApplicationRequest(
|
| // If a valid message pipe to the runner was not provided, look for one on the
|
| // command line.
|
| if (!handle.is_valid()) {
|
| - embedder::ScopedPlatformHandle platform_channel =
|
| - embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
|
| + edk::ScopedPlatformHandle platform_channel =
|
| + edk::PlatformChannelPair::PassClientHandleFromParentProcess(
|
| *base::CommandLine::ForCurrentProcess());
|
| if (!platform_channel.is_valid())
|
| return false;
|
| - scoped_refptr<base::TaskRunner> task_runner;
|
| - if (!base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk"))
|
| - task_runner = base::ThreadTaskRunnerHandle::Get();
|
| - handle =
|
| - embedder::CreateChannel(std::move(platform_channel),
|
| - base::Bind(&DidCreateChannel), task_runner);
|
| + handle = edk::CreateMessagePipe(std::move(platform_channel));
|
| // Copy of code in child_process.cc
|
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) {
|
| - // When using the new Mojo EDK, each message pipe is backed by a platform
|
| - // handle. The one platform handle that comes on the command line is used
|
| - // to bind to the ChildController interface. However we also want a
|
| - // platform handle to setup the communication channel by which we exchange
|
| - // handles to/from tokens, which is needed for sandboxed Windows
|
| - // processes.
|
| - char broker_handle[10];
|
| - MojoHandleSignalsState state;
|
| - MojoResult rv =
|
| - MojoWait(handle.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
|
| - MOJO_DEADLINE_INDEFINITE, &state);
|
| - CHECK_EQ(MOJO_RESULT_OK, rv);
|
| - uint32_t num_bytes = arraysize(broker_handle);
|
| - rv = MojoReadMessage(handle.get().value(),
|
| - broker_handle, &num_bytes, nullptr, 0,
|
| - MOJO_READ_MESSAGE_FLAG_NONE);
|
| - CHECK_EQ(MOJO_RESULT_OK, rv);
|
| -
|
| - edk::ScopedPlatformHandle broker_channel =
|
| - edk::PlatformChannelPair::PassClientHandleFromParentProcessFromString(
|
| - std::string(broker_handle, num_bytes));
|
| - CHECK(broker_channel.is_valid());
|
| - embedder::SetParentPipeHandle(
|
| - mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle(
|
| - broker_channel.release().handle)));
|
| - }
|
| +
|
| + // When using the new Mojo EDK, each message pipe is backed by a platform
|
| + // handle. The one platform handle that comes on the command line is used
|
| + // to bind to the ChildController interface. However we also want a
|
| + // platform handle to setup the communication channel by which we exchange
|
| + // handles to/from tokens, which is needed for sandboxed Windows
|
| + // processes.
|
| + char broker_handle[10];
|
| + MojoHandleSignalsState state;
|
| + MojoResult rv =
|
| + MojoWait(handle.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
|
| + MOJO_DEADLINE_INDEFINITE, &state);
|
| + CHECK_EQ(MOJO_RESULT_OK, rv);
|
| + uint32_t num_bytes = arraysize(broker_handle);
|
| + rv = MojoReadMessage(handle.get().value(),
|
| + broker_handle, &num_bytes, nullptr, 0,
|
| + MOJO_READ_MESSAGE_FLAG_NONE);
|
| + CHECK_EQ(MOJO_RESULT_OK, rv);
|
| +
|
| + edk::ScopedPlatformHandle broker_channel =
|
| + edk::PlatformChannelPair::PassClientHandleFromParentProcessFromString(
|
| + std::string(broker_handle, num_bytes));
|
| + CHECK(broker_channel.is_valid());
|
| + edk::SetParentPipeHandle(std::move(broker_channel));
|
| }
|
|
|
| Blocker blocker;
|
|
|