Index: remoting/host/desktop_process_main.cc |
diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc |
index 2fb0767e0c9c4d2058c429e7f677f620e290d737..05743efd0a1851d67c1d7a8bfae2898e0cef7aec 100644 |
--- a/remoting/host/desktop_process_main.cc |
+++ b/remoting/host/desktop_process_main.cc |
@@ -14,6 +14,10 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
#include "build/build_config.h" |
+#include "mojo/edk/embedder/embedder.h" |
+#include "mojo/edk/embedder/named_platform_channel_pair.h" |
+#include "mojo/edk/embedder/platform_channel_pair.h" |
+#include "mojo/edk/embedder/scoped_ipc_support.h" |
#include "remoting/base/auto_thread.h" |
#include "remoting/base/auto_thread_task_runner.h" |
#include "remoting/host/desktop_process.h" |
@@ -28,12 +32,6 @@ namespace remoting { |
int DesktopProcessMain() { |
const base::CommandLine* command_line = |
base::CommandLine::ForCurrentProcess(); |
- std::string channel_name = |
- command_line->GetSwitchValueASCII(kDaemonPipeSwitchName); |
- |
- if (channel_name.empty()) |
- return kInvalidCommandLineExitCode; |
- |
base::MessageLoopForUI message_loop; |
base::RunLoop run_loop; |
scoped_refptr<AutoThreadTaskRunner> ui_task_runner = |
@@ -49,9 +47,29 @@ int DesktopProcessMain() { |
AutoThread::CreateWithType( |
"Input thread", ui_task_runner, base::MessageLoop::TYPE_IO); |
- DesktopProcess desktop_process(ui_task_runner, |
- input_task_runner, |
- channel_name); |
+ // Launch the I/O thread. |
+ scoped_refptr<AutoThreadTaskRunner> io_task_runner = |
+ AutoThread::CreateWithType("I/O thread", ui_task_runner, |
+ base::MessageLoop::TYPE_IO); |
+ |
+ mojo::edk::ScopedIPCSupport ipc_support(io_task_runner->task_runner()); |
+ mojo::edk::ScopedPlatformHandle parent_pipe = |
+ mojo::edk::PlatformChannelPair::PassClientHandleFromParentProcess( |
+ *command_line); |
+ if (!parent_pipe.is_valid()) { |
+ parent_pipe = |
+ mojo::edk::NamedPlatformChannelPair::PassClientHandleFromParentProcess( |
+ *command_line); |
+ } |
+ if (!parent_pipe.is_valid()) { |
+ return kInvalidCommandLineExitCode; |
+ } |
+ mojo::edk::SetParentPipeHandle(std::move(parent_pipe)); |
+ mojo::ScopedMessagePipeHandle message_pipe = |
+ mojo::edk::CreateChildMessagePipe( |
+ command_line->GetSwitchValueASCII(kMojoPipeToken)); |
+ DesktopProcess desktop_process(ui_task_runner, input_task_runner, |
+ io_task_runner, std::move(message_pipe)); |
// Create a platform-dependent environment factory. |
std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory; |