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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 2451203002: Revert of Use ChannelMojo between the remoting daemon and network processes. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « remoting/host/host_main.cc ('k') | remoting/host/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index ad5592412f3f7da7991398d22b19e9d84e474760..6b01520d8be6693c8677f079894d5eca70615c77 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -33,9 +33,6 @@
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_listener.h"
#include "jingle/glue/thread_wrapper.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "net/base/network_change_notifier.h"
#include "net/base/url_util.h"
#include "net/socket/client_socket_factory.h"
@@ -413,8 +410,6 @@
scoped_refptr<HostProcess> self_;
#if defined(REMOTING_MULTI_PROCESS)
- std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support_;
-
// Accessed on the UI thread.
std::unique_ptr<IPC::ChannelProxy> daemon_channel_;
@@ -459,14 +454,25 @@
bool HostProcess::InitWithCommandLine(const base::CommandLine* cmd_line) {
#if defined(REMOTING_MULTI_PROCESS)
- // Mojo keeps the task runner passed to it alive forever, so an
- // AutoThreadTaskRunner should not be passed to it. Otherwise, the process may
- // never shut down cleanly.
- ipc_support_ = base::MakeUnique<mojo::edk::ScopedIPCSupport>(
- context_->network_task_runner()->task_runner());
- mojo::edk::SetParentPipeHandle(
- mojo::edk::PlatformChannelPair::PassClientHandleFromParentProcess(
- *cmd_line));
+ // Parse the handle value and convert it to a handle/file descriptor.
+ std::string channel_name =
+ cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName);
+
+ int pipe_handle = 0;
+ if (channel_name.empty() ||
+ !base::StringToInt(channel_name, &pipe_handle)) {
+ LOG(ERROR) << "Invalid '" << kDaemonPipeSwitchName
+ << "' value: " << channel_name;
+ return false;
+ }
+
+#if defined(OS_WIN)
+ base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle));
+ IPC::ChannelHandle channel_handle(pipe.Get());
+#elif defined(OS_POSIX)
+ base::FileDescriptor pipe(pipe_handle, true);
+ IPC::ChannelHandle channel_handle(channel_name, pipe);
+#endif // defined(OS_POSIX)
// Connect to the daemon process.
daemon_channel_.reset(
@@ -475,10 +481,7 @@
IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
if (broker && !broker->IsPrivilegedBroker())
broker->RegisterBrokerCommunicationChannel(daemon_channel_.get());
- daemon_channel_->Init(mojo::edk::CreateChildMessagePipe(
- cmd_line->GetSwitchValueASCII(kMojoPipeToken))
- .release(),
- IPC::Channel::MODE_CLIENT,
+ daemon_channel_->Init(channel_handle, IPC::Channel::MODE_CLIENT,
/*create_pipe_now=*/true);
#else // !defined(REMOTING_MULTI_PROCESS)
« no previous file with comments | « remoting/host/host_main.cc ('k') | remoting/host/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698