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_agent.h" | 5 #include "remoting/host/desktop_session_agent.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "ipc/ipc_channel_proxy.h" | 10 #include "ipc/ipc_channel_proxy.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 for (webrtc::DesktopRegion::Iterator i(frame->updated_region()); | 313 for (webrtc::DesktopRegion::Iterator i(frame->updated_region()); |
314 !i.IsAtEnd(); i.Advance()) { | 314 !i.IsAtEnd(); i.Advance()) { |
315 serialized_frame.dirty_region.push_back(i.rect()); | 315 serialized_frame.dirty_region.push_back(i.rect()); |
316 } | 316 } |
317 | 317 |
318 SendToNetwork( | 318 SendToNetwork( |
319 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame)); | 319 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame)); |
320 } | 320 } |
321 | 321 |
322 void DesktopSessionAgent::OnCursorShapeChanged( | 322 void DesktopSessionAgent::OnCursorShapeChanged( |
323 scoped_ptr<media::MouseCursorShape> cursor_shape) { | 323 webrtc::MouseCursorShape* cursor_shape) { |
324 DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); | 324 DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); |
325 | 325 |
| 326 scoped_ptr<webrtc::MouseCursorShape> owned_cursor(cursor_shape); |
| 327 |
326 SendToNetwork(new ChromotingDesktopNetworkMsg_CursorShapeChanged( | 328 SendToNetwork(new ChromotingDesktopNetworkMsg_CursorShapeChanged( |
327 *cursor_shape)); | 329 *cursor_shape)); |
328 } | 330 } |
329 | 331 |
330 void DesktopSessionAgent::InjectClipboardEvent( | 332 void DesktopSessionAgent::InjectClipboardEvent( |
331 const protocol::ClipboardEvent& event) { | 333 const protocol::ClipboardEvent& event) { |
332 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 334 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
333 | 335 |
334 std::string serialized_event; | 336 std::string serialized_event; |
335 if (!event.SerializeToString(&serialized_event)) { | 337 if (!event.SerializeToString(&serialized_event)) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 407 } |
406 | 408 |
407 void DesktopSessionAgent::OnCaptureFrame() { | 409 void DesktopSessionAgent::OnCaptureFrame() { |
408 if (!video_capture_task_runner_->BelongsToCurrentThread()) { | 410 if (!video_capture_task_runner_->BelongsToCurrentThread()) { |
409 video_capture_task_runner_->PostTask( | 411 video_capture_task_runner_->PostTask( |
410 FROM_HERE, | 412 FROM_HERE, |
411 base::Bind(&DesktopSessionAgent::OnCaptureFrame, this)); | 413 base::Bind(&DesktopSessionAgent::OnCaptureFrame, this)); |
412 return; | 414 return; |
413 } | 415 } |
414 | 416 |
415 // media::ScreenCapturer supports a very few (currently 2) outstanding capture | 417 // webrtc::ScreenCapturer supports a very few (currently 2) outstanding |
416 // requests. The requests are serialized on |video_capture_task_runner()| task | 418 // capture requests. The requests are serialized on |
417 // runner. If the client issues more requests, pixel data in captured frames | 419 // |video_capture_task_runner()| task runner. If the client issues more |
418 // will likely be corrupted but stability of media::ScreenCapturer will not be | 420 // requests, pixel data in captured frames will likely be corrupted but |
419 // affected. | 421 // stability of webrtc::ScreenCapturer will not be affected. |
420 video_capturer_->Capture(webrtc::DesktopRegion()); | 422 video_capturer_->Capture(webrtc::DesktopRegion()); |
421 } | 423 } |
422 | 424 |
423 void DesktopSessionAgent::OnInjectClipboardEvent( | 425 void DesktopSessionAgent::OnInjectClipboardEvent( |
424 const std::string& serialized_event) { | 426 const std::string& serialized_event) { |
425 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 427 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
426 | 428 |
427 protocol::ClipboardEvent event; | 429 protocol::ClipboardEvent event; |
428 if (!event.ParseFromString(serialized_event)) { | 430 if (!event.ParseFromString(serialized_event)) { |
429 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; | 431 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 base::ClosePlatformFile(desktop_pipe_.fd); | 546 base::ClosePlatformFile(desktop_pipe_.fd); |
545 #else // !defined(OS_POSIX) | 547 #else // !defined(OS_POSIX) |
546 #error Unsupported platform. | 548 #error Unsupported platform. |
547 #endif // !defined(OS_POSIX) | 549 #endif // !defined(OS_POSIX) |
548 | 550 |
549 desktop_pipe_ = IPC::InvalidPlatformFileForTransit(); | 551 desktop_pipe_ = IPC::InvalidPlatformFileForTransit(); |
550 } | 552 } |
551 } | 553 } |
552 | 554 |
553 } // namespace remoting | 555 } // namespace remoting |
OLD | NEW |