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

Side by Side Diff: remoting/host/desktop_session_proxy.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
« no previous file with comments | « remoting/host/desktop_session_proxy.h ('k') | remoting/host/desktop_session_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/desktop_session_proxy.h" 5 #include "remoting/host/desktop_session_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 #endif // defined(OS_WIN) 211 #endif // defined(OS_WIN)
212 } 212 }
213 213
214 void DesktopSessionProxy::OnChannelError() { 214 void DesktopSessionProxy::OnChannelError() {
215 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 215 DCHECK(caller_task_runner_->BelongsToCurrentThread());
216 216
217 DetachFromDesktop(); 217 DetachFromDesktop();
218 } 218 }
219 219
220 bool DesktopSessionProxy::AttachToDesktop( 220 bool DesktopSessionProxy::AttachToDesktop(
221 base::Process desktop_process, 221 const IPC::ChannelHandle& desktop_pipe) {
222 IPC::PlatformFileForTransit desktop_pipe) {
223 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 222 DCHECK(caller_task_runner_->BelongsToCurrentThread());
224 DCHECK(!desktop_channel_); 223 DCHECK(!desktop_channel_);
225 DCHECK(!desktop_process_.IsValid());
226 224
227 // Ignore the attach notification if the client session has been disconnected 225 // Ignore the attach notification if the client session has been disconnected
228 // already. 226 // already.
229 if (!client_session_control_.get()) 227 if (!client_session_control_.get())
230 return false; 228 return false;
231 229
232 desktop_process_ = std::move(desktop_process);
233
234 #if defined(OS_WIN)
235 base::win::ScopedHandle pipe(desktop_pipe.GetHandle());
236 IPC::ChannelHandle desktop_channel_handle(pipe.Get());
237 #elif defined(OS_POSIX)
238 // On posix: |desktop_pipe| is a valid file descriptor.
239 DCHECK(desktop_pipe.auto_close);
240
241 IPC::ChannelHandle desktop_channel_handle(std::string(), desktop_pipe);
242 #else
243 #error Unsupported platform.
244 #endif
245
246 // Connect to the desktop process. 230 // Connect to the desktop process.
247 desktop_channel_ = IPC::ChannelProxy::Create(desktop_channel_handle, 231 desktop_channel_ = IPC::ChannelProxy::Create(desktop_pipe,
248 IPC::Channel::MODE_CLIENT, this, 232 IPC::Channel::MODE_CLIENT, this,
249 io_task_runner_.get()); 233 io_task_runner_.get());
250 234
251 // Pass ID of the client (which is authenticated at this point) to the desktop 235 // Pass ID of the client (which is authenticated at this point) to the desktop
252 // session agent and start the agent. 236 // session agent and start the agent.
253 SendToDesktop(new ChromotingNetworkDesktopMsg_StartSessionAgent( 237 SendToDesktop(new ChromotingNetworkDesktopMsg_StartSessionAgent(
254 client_session_control_->client_jid(), 238 client_session_control_->client_jid(),
255 screen_resolution_, 239 screen_resolution_,
256 virtual_terminal_)); 240 virtual_terminal_));
257 241
258 return true; 242 return true;
259 } 243 }
260 244
261 void DesktopSessionProxy::DetachFromDesktop() { 245 void DesktopSessionProxy::DetachFromDesktop() {
262 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 246 DCHECK(caller_task_runner_->BelongsToCurrentThread());
263 247
264 desktop_channel_.reset(); 248 desktop_channel_.reset();
265 desktop_session_id_ = UINT32_MAX; 249 desktop_session_id_ = UINT32_MAX;
266 250
267 if (desktop_process_.IsValid())
268 desktop_process_.Close();
269
270 shared_buffers_.clear(); 251 shared_buffers_.clear();
271 252
272 // Generate fake responses to keep the video capturer in sync. 253 // Generate fake responses to keep the video capturer in sync.
273 while (pending_capture_frame_requests_) { 254 while (pending_capture_frame_requests_) {
274 --pending_capture_frame_requests_; 255 --pending_capture_frame_requests_;
275 video_capturer_->OnCaptureResult( 256 video_capturer_->OnCaptureResult(
276 webrtc::DesktopCapturer::Result::ERROR_PERMANENT, nullptr); 257 webrtc::DesktopCapturer::Result::ERROR_PERMANENT, nullptr);
277 } 258 }
278 } 259 }
279 260
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 533 }
553 534
554 // static 535 // static
555 void DesktopSessionProxyTraits::Destruct( 536 void DesktopSessionProxyTraits::Destruct(
556 const DesktopSessionProxy* desktop_session_proxy) { 537 const DesktopSessionProxy* desktop_session_proxy) {
557 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, 538 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE,
558 desktop_session_proxy); 539 desktop_session_proxy);
559 } 540 }
560 541
561 } // namespace remoting 542 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_proxy.h ('k') | remoting/host/desktop_session_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698