OLD | NEW |
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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 IPC::ChannelHandle desktop_channel_handle(std::string(), desktop_pipe); | 246 IPC::ChannelHandle desktop_channel_handle(std::string(), desktop_pipe); |
247 | 247 |
248 #else | 248 #else |
249 #error Unsupported platform. | 249 #error Unsupported platform. |
250 #endif | 250 #endif |
251 | 251 |
252 // Connect to the desktop process. | 252 // Connect to the desktop process. |
253 desktop_channel_.reset(new IPC::ChannelProxy(desktop_channel_handle, | 253 desktop_channel_.reset(new IPC::ChannelProxy(desktop_channel_handle, |
254 IPC::Channel::MODE_CLIENT, | 254 IPC::Channel::MODE_CLIENT, |
255 this, | 255 this, |
256 io_task_runner_)); | 256 io_task_runner_.get())); |
257 | 257 |
258 // Pass ID of the client (which is authenticated at this point) to the desktop | 258 // Pass ID of the client (which is authenticated at this point) to the desktop |
259 // session agent and start the agent. | 259 // session agent and start the agent. |
260 SendToDesktop(new ChromotingNetworkDesktopMsg_StartSessionAgent( | 260 SendToDesktop(new ChromotingNetworkDesktopMsg_StartSessionAgent( |
261 client_session_control_->client_jid(), | 261 client_session_control_->client_jid(), |
262 screen_resolution_, | 262 screen_resolution_, |
263 virtual_terminal_)); | 263 virtual_terminal_)); |
264 | 264 |
265 return true; | 265 return true; |
266 } | 266 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 462 } |
463 | 463 |
464 void DesktopSessionProxy::OnCaptureCompleted( | 464 void DesktopSessionProxy::OnCaptureCompleted( |
465 const SerializedDesktopFrame& serialized_frame) { | 465 const SerializedDesktopFrame& serialized_frame) { |
466 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 466 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
467 | 467 |
468 // Assume that |serialized_frame| is well-formed because it was received from | 468 // Assume that |serialized_frame| is well-formed because it was received from |
469 // a more privileged process. | 469 // a more privileged process. |
470 scoped_refptr<IpcSharedBufferCore> shared_buffer_core = | 470 scoped_refptr<IpcSharedBufferCore> shared_buffer_core = |
471 GetSharedBufferCore(serialized_frame.shared_buffer_id); | 471 GetSharedBufferCore(serialized_frame.shared_buffer_id); |
472 CHECK(shared_buffer_core); | 472 CHECK(shared_buffer_core.get()); |
473 | 473 |
474 scoped_ptr<webrtc::DesktopFrame> frame( | 474 scoped_ptr<webrtc::DesktopFrame> frame( |
475 new webrtc::SharedMemoryDesktopFrame( | 475 new webrtc::SharedMemoryDesktopFrame( |
476 serialized_frame.dimensions, serialized_frame.bytes_per_row, | 476 serialized_frame.dimensions, serialized_frame.bytes_per_row, |
477 new IpcSharedBuffer(shared_buffer_core))); | 477 new IpcSharedBuffer(shared_buffer_core))); |
478 frame->set_capture_time_ms(serialized_frame.capture_time_ms); | 478 frame->set_capture_time_ms(serialized_frame.capture_time_ms); |
479 frame->set_dpi(serialized_frame.dpi); | 479 frame->set_dpi(serialized_frame.dpi); |
480 | 480 |
481 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { | 481 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { |
482 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); | 482 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 539 } |
540 | 540 |
541 // static | 541 // static |
542 void DesktopSessionProxyTraits::Destruct( | 542 void DesktopSessionProxyTraits::Destruct( |
543 const DesktopSessionProxy* desktop_session_proxy) { | 543 const DesktopSessionProxy* desktop_session_proxy) { |
544 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 544 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
545 desktop_session_proxy); | 545 desktop_session_proxy); |
546 } | 546 } |
547 | 547 |
548 } // namespace remoting | 548 } // namespace remoting |
OLD | NEW |