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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/shared_memory.h" | 14 #include "base/memory/shared_memory.h" |
13 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
14 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
15 #include "build/build_config.h" | 17 #include "build/build_config.h" |
16 #include "ipc/ipc_channel_proxy.h" | 18 #include "ipc/ipc_channel_proxy.h" |
17 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
18 #include "remoting/base/capabilities.h" | 20 #include "remoting/base/capabilities.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 IPC::PlatformFileForTransit desktop_pipe) { | 224 IPC::PlatformFileForTransit desktop_pipe) { |
223 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 225 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
224 DCHECK(!desktop_channel_); | 226 DCHECK(!desktop_channel_); |
225 DCHECK(!desktop_process_.IsValid()); | 227 DCHECK(!desktop_process_.IsValid()); |
226 | 228 |
227 // Ignore the attach notification if the client session has been disconnected | 229 // Ignore the attach notification if the client session has been disconnected |
228 // already. | 230 // already. |
229 if (!client_session_control_.get()) | 231 if (!client_session_control_.get()) |
230 return false; | 232 return false; |
231 | 233 |
232 desktop_process_ = desktop_process.Pass(); | 234 desktop_process_ = std::move(desktop_process); |
233 | 235 |
234 #if defined(OS_WIN) | 236 #if defined(OS_WIN) |
235 // On Windows: |desktop_process| is a valid handle, but |desktop_pipe| needs | 237 // On Windows: |desktop_process| is a valid handle, but |desktop_pipe| needs |
236 // to be duplicated from the desktop process. | 238 // to be duplicated from the desktop process. |
237 HANDLE temp_handle; | 239 HANDLE temp_handle; |
238 if (!DuplicateHandle(desktop_process_.Handle(), desktop_pipe, | 240 if (!DuplicateHandle(desktop_process_.Handle(), desktop_pipe, |
239 GetCurrentProcess(), &temp_handle, 0, | 241 GetCurrentProcess(), &temp_handle, 0, |
240 FALSE, DUPLICATE_SAME_ACCESS)) { | 242 FALSE, DUPLICATE_SAME_ACCESS)) { |
241 PLOG(ERROR) << "Failed to duplicate the desktop-to-network pipe handle"; | 243 PLOG(ERROR) << "Failed to duplicate the desktop-to-network pipe handle"; |
242 | 244 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 398 } |
397 | 399 |
398 SendToDesktop( | 400 SendToDesktop( |
399 new ChromotingNetworkDesktopMsg_InjectTouchEvent(serialized_event)); | 401 new ChromotingNetworkDesktopMsg_InjectTouchEvent(serialized_event)); |
400 } | 402 } |
401 | 403 |
402 void DesktopSessionProxy::StartInputInjector( | 404 void DesktopSessionProxy::StartInputInjector( |
403 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 405 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
404 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 406 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
405 | 407 |
406 client_clipboard_ = client_clipboard.Pass(); | 408 client_clipboard_ = std::move(client_clipboard); |
407 } | 409 } |
408 | 410 |
409 void DesktopSessionProxy::SetScreenResolution( | 411 void DesktopSessionProxy::SetScreenResolution( |
410 const ScreenResolution& resolution) { | 412 const ScreenResolution& resolution) { |
411 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 413 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
412 | 414 |
413 if (resolution.IsEmpty()) | 415 if (resolution.IsEmpty()) |
414 return; | 416 return; |
415 | 417 |
416 screen_resolution_ = resolution; | 418 screen_resolution_ = resolution; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 serialized_frame.dimensions, serialized_frame.bytes_per_row, | 517 serialized_frame.dimensions, serialized_frame.bytes_per_row, |
516 new IpcSharedBuffer(shared_buffer_core))); | 518 new IpcSharedBuffer(shared_buffer_core))); |
517 frame->set_capture_time_ms(serialized_frame.capture_time_ms); | 519 frame->set_capture_time_ms(serialized_frame.capture_time_ms); |
518 frame->set_dpi(serialized_frame.dpi); | 520 frame->set_dpi(serialized_frame.dpi); |
519 | 521 |
520 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { | 522 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { |
521 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); | 523 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); |
522 } | 524 } |
523 | 525 |
524 --pending_capture_frame_requests_; | 526 --pending_capture_frame_requests_; |
525 PostCaptureCompleted(frame.Pass()); | 527 PostCaptureCompleted(std::move(frame)); |
526 } | 528 } |
527 | 529 |
528 void DesktopSessionProxy::OnMouseCursor( | 530 void DesktopSessionProxy::OnMouseCursor( |
529 const webrtc::MouseCursor& mouse_cursor) { | 531 const webrtc::MouseCursor& mouse_cursor) { |
530 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 532 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
531 PostMouseCursor(make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor))); | 533 PostMouseCursor(make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor))); |
532 } | 534 } |
533 | 535 |
534 void DesktopSessionProxy::OnInjectClipboardEvent( | 536 void DesktopSessionProxy::OnInjectClipboardEvent( |
535 const std::string& serialized_event) { | 537 const std::string& serialized_event) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 579 } |
578 | 580 |
579 // static | 581 // static |
580 void DesktopSessionProxyTraits::Destruct( | 582 void DesktopSessionProxyTraits::Destruct( |
581 const DesktopSessionProxy* desktop_session_proxy) { | 583 const DesktopSessionProxy* desktop_session_proxy) { |
582 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 584 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
583 desktop_session_proxy); | 585 desktop_session_proxy); |
584 } | 586 } |
585 | 587 |
586 } // namespace remoting | 588 } // namespace remoting |
OLD | NEW |