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

Unified Diff: mojo/runner/child_process_host.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: move to mojo::edk namespace in preparation for runtim flag 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_host.cc
diff --git a/mojo/runner/child_process_host.cc b/mojo/runner/child_process_host.cc
index f5fe0f54f22308a033c32d1bd81fb610e3a6cbe0..6c9ed27f96adfb353f95e9ba172950ad99b37815 100644
--- a/mojo/runner/child_process_host.cc
+++ b/mojo/runner/child_process_host.cc
@@ -15,13 +15,18 @@
#include "base/task_runner.h"
#include "base/task_runner_util.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/context.h"
#include "mojo/runner/switches.h"
#include "mojo/runner/task_runners.h"
+#if defined(USE_CHROME_EDK)
+#include "mojo/edk/embedder/embedder.h"
+#else
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
+#endif
+
#if defined(OS_LINUX) && !defined(OS_ANDROID)
#include "sandbox/linux/services/namespace_sandbox.h"
#endif
@@ -34,8 +39,12 @@ ChildProcessHost::ChildProcessHost(Context* context,
const base::FilePath& app_path)
: context_(context),
start_sandboxed_(start_sandboxed),
- app_path_(app_path),
- channel_info_(nullptr) {
+ app_path_(app_path)
+#if !defined(USE_CHROME_EDK)
+ ,
+ channel_info_(nullptr)
+#endif
+{
platform_channel_ = platform_channel_pair_.PassServerHandle();
CHECK(platform_channel_.is_valid());
}
@@ -51,10 +60,15 @@ void ChildProcessHost::Start() {
DCHECK(!child_process_.IsValid());
DCHECK(platform_channel_.is_valid());
+#if defined(USE_CHROME_EDK)
+ ScopedMessagePipeHandle handle(
+ edk::CreateMessagePipe(platform_channel_.Pass()));
+#else
ScopedMessagePipeHandle handle(embedder::CreateChannel(
platform_channel_.Pass(),
base::Bind(&ChildProcessHost::DidCreateChannel, base::Unretained(this)),
base::ThreadTaskRunnerHandle::Get()));
+#endif
controller_.Bind(InterfacePtrInfo<ChildController>(handle.Pass(), 0u));
@@ -110,9 +124,15 @@ bool ChildProcessHost::DoLaunch() {
if (start_sandboxed_)
child_command_line.AppendSwitch(switches::kEnableSandbox);
+#if defined(USE_CHROME_EDK)
+ edk::HandlePassingInformation handle_passing_info;
+ platform_channel_pair_.PrepareToPassClientHandleToChildProcess(
+ &child_command_line, &handle_passing_info);
+#else
embedder::HandlePassingInformation handle_passing_info;
platform_channel_pair_.PrepareToPassClientHandleToChildProcess(
&child_command_line, &handle_passing_info);
+#endif
base::LaunchOptions options;
#if defined(OS_WIN)
@@ -153,12 +173,14 @@ void ChildProcessHost::AppCompleted(int32_t result) {
}
}
+#if !defined(USE_CHROME_EDK)
void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) {
DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
CHECK(channel_info);
channel_info_ = channel_info;
}
+#endif
} // namespace runner
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698