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

Unified Diff: mojo/runner/child_process.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: convert remaining MP tests and simplify RawChannel destruction Created 5 years, 3 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: mojo/runner/child_process.cc
diff --git a/mojo/runner/child_process.cc b/mojo/runner/child_process.cc
index dc9b59f2a77cbfe5ac52fe6c376847fef41178f5..d662bdf850f1c25118145054ac15b1b33724e759 100644
--- a/mojo/runner/child_process.cc
+++ b/mojo/runner/child_process.cc
@@ -20,11 +20,6 @@
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread.h"
#include "base/threading/thread_checker.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/process_delegate.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "mojo/edk/embedder/simple_platform_support.h"
#include "mojo/message_pump/message_pump_mojo.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/system/core.h"
@@ -32,6 +27,20 @@
#include "mojo/runner/native_application_support.h"
#include "mojo/runner/switches.h"
+#if defined(USE_CHROME_EDK)
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/process_delegate.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#else
+#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/process_delegate.h"
+#include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
+#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
+#endif
+
#if defined(OS_LINUX) && !defined(OS_ANDROID)
#include "base/rand_util.h"
#include "base/sys_info.h"
@@ -199,11 +208,16 @@ class ChildControllerImpl : public ChildController {
scoped_ptr<ChildControllerImpl> impl(
new ChildControllerImpl(app_context, app_library, unblocker));
+#if defined(USE_CHROME_EDK)
+ ScopedMessagePipeHandle host_message_pipe(
+ embedder::CreateMessagePipe(platform_channel.Pass()));
+#else
ScopedMessagePipeHandle host_message_pipe(embedder::CreateChannel(
platform_channel.Pass(),
base::Bind(&ChildControllerImpl::DidCreateChannel,
base::Unretained(impl.get())),
base::ThreadTaskRunnerHandle::Get()));
+#endif
impl->Bind(host_message_pipe.Pass());
@@ -242,17 +256,21 @@ class ChildControllerImpl : public ChildController {
: app_context_(app_context),
app_library_(app_library),
unblocker_(unblocker),
+#if !defined(USE_CHROME_EDK)
channel_info_(nullptr),
+#endif
binding_(this) {
binding_.set_connection_error_handler([this]() { OnConnectionError(); });
}
+#if !defined(USE_CHROME_EDK)
// Callback for |embedder::CreateChannel()|.
void DidCreateChannel(embedder::ChannelInfo* channel_info) {
DVLOG(2) << "ChildControllerImpl::DidCreateChannel()";
DCHECK(thread_checker_.CalledOnValidThread());
channel_info_ = channel_info;
}
+#endif
static void StartAppOnMainThread(
base::NativeLibrary app_library,
@@ -268,7 +286,9 @@ class ChildControllerImpl : public ChildController {
Blocker::Unblocker unblocker_;
StartAppCallback on_app_complete_;
+#if !defined(USE_CHROME_EDK)
embedder::ChannelInfo* channel_info_;
+#endif
Binding<ChildController> binding_;
DISALLOW_COPY_AND_ASSIGN(ChildControllerImpl);

Powered by Google App Engine
This is Rietveld 408576698