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

Unified Diff: remoting/host/desktop_session_agent.cc

Issue 2451953002: Use ChannelMojo between the remoting network and desktop processes. (Closed)
Patch Set: Created 4 years, 1 month 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/desktop_session_agent.h ('k') | remoting/host/desktop_session_connector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/desktop_session_agent.cc
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 63daad84cc61369d988b3580b108c3b0b29bcedc..df5c1b218a2c1fbd277f4cf0f4870ab44cd10826 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -13,7 +13,6 @@
#include "base/memory/shared_memory.h"
#include "base/process/process_handle.h"
#include "build/build_config.h"
-#include "ipc/attachment_broker.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_message_macros.h"
@@ -207,20 +206,13 @@ void DesktopSessionAgent::OnChannelConnected(int32_t peer_pid) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
VLOG(1) << "IPC: desktop <- network (" << peer_pid << ")";
-
- desktop_pipe_.Close();
}
void DesktopSessionAgent::OnChannelError() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
// Make sure the channel is closed.
- if (IPC::AttachmentBroker::GetGlobal()) {
- IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
- network_channel_.get());
- }
network_channel_.reset();
- desktop_pipe_.Close();
// Notify the caller that the channel has been disconnected.
if (delegate_.get())
@@ -390,28 +382,17 @@ void DesktopSessionAgent::ProcessAudioPacket(
serialized_packet));
}
-bool DesktopSessionAgent::Start(const base::WeakPtr<Delegate>& delegate,
- IPC::PlatformFileForTransit* desktop_pipe_out) {
+mojo::ScopedMessagePipeHandle DesktopSessionAgent::Start(
+ const base::WeakPtr<Delegate>& delegate) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
DCHECK(delegate_.get() == nullptr);
delegate_ = delegate;
- // Create an IPC channel to communicate with the network process.
- bool result = CreateConnectedIpcChannel(io_task_runner_,
- this,
- &desktop_pipe_,
- &network_channel_);
- base::PlatformFile raw_desktop_pipe = desktop_pipe_.GetPlatformFile();
-#if defined(OS_WIN)
- *desktop_pipe_out =
- IPC::PlatformFileForTransit(raw_desktop_pipe, base::GetCurrentProcId());
-#elif defined(OS_POSIX)
- *desktop_pipe_out = IPC::PlatformFileForTransit(raw_desktop_pipe, false);
-#else
-#error Unsupported platform.
-#endif
- return result;
+ mojo::MessagePipe pipe;
+ network_channel_ = IPC::ChannelProxy::Create(
+ pipe.handle0.release(), IPC::Channel::MODE_SERVER, this, io_task_runner_);
+ return std::move(pipe.handle1);
}
void DesktopSessionAgent::Stop() {
@@ -420,10 +401,6 @@ void DesktopSessionAgent::Stop() {
delegate_.reset();
// Make sure the channel is closed.
- if (IPC::AttachmentBroker::GetGlobal()) {
- IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
- network_channel_.get());
- }
network_channel_.reset();
if (started_) {
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698