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

Side by Side Diff: remoting/host/ipc_desktop_environment.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/ipc_desktop_environment.h" 5 #include "remoting/host/ipc_desktop_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/process/process_handle.h" 12 #include "base/process/process_handle.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ipc/ipc_channel_handle.h"
15 #include "ipc/ipc_sender.h" 16 #include "ipc/ipc_sender.h"
16 #include "remoting/host/audio_capturer.h" 17 #include "remoting/host/audio_capturer.h"
17 #include "remoting/host/chromoting_messages.h" 18 #include "remoting/host/chromoting_messages.h"
18 #include "remoting/host/client_session_control.h" 19 #include "remoting/host/client_session_control.h"
19 #include "remoting/host/desktop_session.h" 20 #include "remoting/host/desktop_session.h"
20 #include "remoting/host/desktop_session_proxy.h" 21 #include "remoting/host/desktop_session_proxy.h"
21 #include "remoting/host/input_injector.h" 22 #include "remoting/host/input_injector.h"
22 #include "remoting/host/screen_controls.h" 23 #include "remoting/host/screen_controls.h"
23 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" 24 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
24 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" 25 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 159 }
159 160
160 if (i != active_connections_.end()) { 161 if (i != active_connections_.end()) {
161 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SetScreenResolution( 162 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SetScreenResolution(
162 i->first, resolution)); 163 i->first, resolution));
163 } 164 }
164 } 165 }
165 166
166 void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached( 167 void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached(
167 int terminal_id, 168 int terminal_id,
168 base::ProcessHandle desktop_process_handle, 169 const IPC::ChannelHandle& desktop_pipe) {
169 IPC::PlatformFileForTransit desktop_pipe) {
170 if (!caller_task_runner_->BelongsToCurrentThread()) { 170 if (!caller_task_runner_->BelongsToCurrentThread()) {
171 caller_task_runner_->PostTask(FROM_HERE, base::Bind( 171 caller_task_runner_->PostTask(
172 &IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached, 172 FROM_HERE,
173 base::Unretained(this), terminal_id, desktop_process_handle, 173 base::Bind(&IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached,
174 desktop_pipe)); 174 base::Unretained(this), terminal_id, desktop_pipe));
175 return; 175 return;
176 } 176 }
177 177
178 base::Process desktop_process(desktop_process_handle);
179 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); 178 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id);
180 if (i != active_connections_.end()) { 179 if (i != active_connections_.end()) {
181 i->second->DetachFromDesktop(); 180 i->second->DetachFromDesktop();
182 i->second->AttachToDesktop(std::move(desktop_process), desktop_pipe); 181 i->second->AttachToDesktop(desktop_pipe);
183 } else { 182 } else {
184 #if defined(OS_POSIX) 183 mojo::ScopedMessagePipeHandle closer(desktop_pipe.mojo_handle);
185 DCHECK(desktop_pipe.auto_close);
186 base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe));
187 #endif // defined(OS_POSIX)
188 } 184 }
189 } 185 }
190 186
191 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { 187 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) {
192 if (!caller_task_runner_->BelongsToCurrentThread()) { 188 if (!caller_task_runner_->BelongsToCurrentThread()) {
193 caller_task_runner_->PostTask(FROM_HERE, base::Bind( 189 caller_task_runner_->PostTask(FROM_HERE, base::Bind(
194 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, 190 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected,
195 base::Unretained(this), terminal_id)); 191 base::Unretained(this), terminal_id));
196 return; 192 return;
197 } 193 }
198 194
199 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); 195 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id);
200 if (i != active_connections_.end()) { 196 if (i != active_connections_.end()) {
201 DesktopSessionProxy* desktop_session_proxy = i->second; 197 DesktopSessionProxy* desktop_session_proxy = i->second;
202 active_connections_.erase(i); 198 active_connections_.erase(i);
203 199
204 // Disconnect the client session. 200 // Disconnect the client session.
205 desktop_session_proxy->DisconnectSession(protocol::OK); 201 desktop_session_proxy->DisconnectSession(protocol::OK);
206 } 202 }
207 } 203 }
208 204
209 } // namespace remoting 205 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_desktop_environment.h ('k') | remoting/host/ipc_desktop_environment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698