Chromium Code Reviews| 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" | 
| 11 #include "base/memory/shared_memory.h" | |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" | 
| 12 #include "ipc/ipc_channel_proxy.h" | 13 #include "ipc/ipc_channel_proxy.h" | 
| 13 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" | 
| 14 #include "media/video/capture/screen/screen_capture_data.h" | |
| 15 #include "remoting/base/capabilities.h" | 15 #include "remoting/base/capabilities.h" | 
| 16 #include "remoting/host/chromoting_messages.h" | 16 #include "remoting/host/chromoting_messages.h" | 
| 17 #include "remoting/host/client_session.h" | 17 #include "remoting/host/client_session.h" | 
| 18 #include "remoting/host/client_session_control.h" | 18 #include "remoting/host/client_session_control.h" | 
| 19 #include "remoting/host/desktop_session_connector.h" | 19 #include "remoting/host/desktop_session_connector.h" | 
| 20 #include "remoting/host/ipc_audio_capturer.h" | 20 #include "remoting/host/ipc_audio_capturer.h" | 
| 21 #include "remoting/host/ipc_input_injector.h" | 21 #include "remoting/host/ipc_input_injector.h" | 
| 22 #include "remoting/host/ipc_screen_controls.h" | 22 #include "remoting/host/ipc_screen_controls.h" | 
| 23 #include "remoting/host/ipc_video_frame_capturer.h" | 23 #include "remoting/host/ipc_video_frame_capturer.h" | 
| 24 #include "remoting/proto/audio.pb.h" | 24 #include "remoting/proto/audio.pb.h" | 
| 25 #include "remoting/proto/control.pb.h" | 25 #include "remoting/proto/control.pb.h" | 
| 26 #include "remoting/proto/event.pb.h" | 26 #include "remoting/proto/event.pb.h" | 
| 27 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | |
| 28 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
| 29 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" | |
| 27 | 30 | 
| 28 #if defined(OS_WIN) | 31 #if defined(OS_WIN) | 
| 29 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" | 
| 30 #endif // defined(OS_WIN) | 33 #endif // defined(OS_WIN) | 
| 31 | 34 | 
| 35 const bool kReadOnly = true; | |
| 32 const char kSendInitialResolution[] = "sendInitialResolution"; | 36 const char kSendInitialResolution[] = "sendInitialResolution"; | 
| 33 | 37 | 
| 34 namespace remoting { | 38 namespace remoting { | 
| 35 | 39 | 
| 40 class DesktopSessionProxy::IpcSharedBufferCore | |
| 41 : public base::RefCountedThreadSafe<IpcSharedBufferCore> { | |
| 42 public: | |
| 43 IpcSharedBufferCore(int id, | |
| 44 base::SharedMemoryHandle handle, | |
| 45 size_t size) | |
| 46 : id_(id), | |
| 47 shared_memory_(handle, kReadOnly), | |
| 48 size_(size) { | |
| 49 shared_memory_.Map(size); | |
| 50 } | |
| 51 | |
| 52 IpcSharedBufferCore(int id, | |
| 53 base::SharedMemoryHandle handle, | |
| 54 base::ProcessHandle process, | |
| 55 size_t size) | |
| 56 : id_(id), | |
| 57 shared_memory_(handle, kReadOnly, process), | |
| 58 size_(size) { | |
| 59 shared_memory_.Map(size); | |
| 60 } | |
| 61 | |
| 62 int id() { return id_; } | |
| 63 size_t size() { return size_; } | |
| 64 void* memory() { return shared_memory_.memory(); } | |
| 65 webrtc::SharedMemory::Handle handle() { | |
| 66 #if defined(OS_WIN) | |
| 67 return shared_memory_.handle(); | |
| 68 #else | |
| 69 return shared_memory_.handle().fd; | |
| 70 #endif | |
| 71 } | |
| 72 | |
| 
 
alexeypa (please no reviews)
2013/05/13 17:02:00
nit: Remove one empty line.
 
Sergey Ulanov
2013/05/13 21:16:52
Done.
 
 | |
| 73 | |
| 74 private: | |
| 75 virtual ~IpcSharedBufferCore() {} | |
| 76 friend class base::RefCountedThreadSafe<IpcSharedBufferCore>; | |
| 77 | |
| 78 int id_; | |
| 79 base::SharedMemory shared_memory_; | |
| 80 size_t size_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(IpcSharedBufferCore); | |
| 83 }; | |
| 84 | |
| 85 class DesktopSessionProxy::IpcSharedBuffer : public webrtc::SharedMemory { | |
| 86 public: | |
| 87 IpcSharedBuffer(scoped_refptr<IpcSharedBufferCore> core) | |
| 88 : SharedMemory(core->memory(), core->size(), | |
| 89 core->handle(), core->id()), | |
| 90 core_(core) { | |
| 91 } | |
| 92 | |
| 93 private: | |
| 94 scoped_refptr<IpcSharedBufferCore> core_; | |
| 95 | |
| 96 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer); | |
| 97 }; | |
| 98 | |
| 36 DesktopSessionProxy::DesktopSessionProxy( | 99 DesktopSessionProxy::DesktopSessionProxy( | 
| 37 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, | 100 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, | 
| 38 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 
| 39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 102 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 
| 40 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 103 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 
| 41 base::WeakPtr<ClientSessionControl> client_session_control, | 104 base::WeakPtr<ClientSessionControl> client_session_control, | 
| 42 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | 105 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | 
| 43 bool virtual_terminal) | 106 bool virtual_terminal) | 
| 44 : audio_capture_task_runner_(audio_capture_task_runner), | 107 : audio_capture_task_runner_(audio_capture_task_runner), | 
| 45 caller_task_runner_(caller_task_runner), | 108 caller_task_runner_(caller_task_runner), | 
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 if (desktop_process_ != base::kNullProcessHandle) { | 271 if (desktop_process_ != base::kNullProcessHandle) { | 
| 209 base::CloseProcessHandle(desktop_process_); | 272 base::CloseProcessHandle(desktop_process_); | 
| 210 desktop_process_ = base::kNullProcessHandle; | 273 desktop_process_ = base::kNullProcessHandle; | 
| 211 } | 274 } | 
| 212 | 275 | 
| 213 shared_buffers_.clear(); | 276 shared_buffers_.clear(); | 
| 214 | 277 | 
| 215 // Generate fake responses to keep the video capturer in sync. | 278 // Generate fake responses to keep the video capturer in sync. | 
| 216 while (pending_capture_frame_requests_) { | 279 while (pending_capture_frame_requests_) { | 
| 217 --pending_capture_frame_requests_; | 280 --pending_capture_frame_requests_; | 
| 218 PostCaptureCompleted(scoped_refptr<media::ScreenCaptureData>()); | 281 PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame>()); | 
| 219 } | 282 } | 
| 220 } | 283 } | 
| 221 | 284 | 
| 222 void DesktopSessionProxy::SetAudioCapturer( | 285 void DesktopSessionProxy::SetAudioCapturer( | 
| 223 const base::WeakPtr<IpcAudioCapturer>& audio_capturer) { | 286 const base::WeakPtr<IpcAudioCapturer>& audio_capturer) { | 
| 224 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); | 287 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); | 
| 225 | 288 | 
| 226 audio_capturer_ = audio_capturer; | 289 audio_capturer_ = audio_capturer; | 
| 227 } | 290 } | 
| 228 | 291 | 
| 229 void DesktopSessionProxy::CaptureFrame() { | 292 void DesktopSessionProxy::CaptureFrame() { | 
| 230 if (!caller_task_runner_->BelongsToCurrentThread()) { | 293 if (!caller_task_runner_->BelongsToCurrentThread()) { | 
| 231 caller_task_runner_->PostTask( | 294 caller_task_runner_->PostTask( | 
| 232 FROM_HERE, base::Bind(&DesktopSessionProxy::CaptureFrame, this)); | 295 FROM_HERE, base::Bind(&DesktopSessionProxy::CaptureFrame, this)); | 
| 233 return; | 296 return; | 
| 234 } | 297 } | 
| 235 | 298 | 
| 236 if (desktop_channel_) { | 299 if (desktop_channel_) { | 
| 237 ++pending_capture_frame_requests_; | 300 ++pending_capture_frame_requests_; | 
| 238 SendToDesktop(new ChromotingNetworkDesktopMsg_CaptureFrame()); | 301 SendToDesktop(new ChromotingNetworkDesktopMsg_CaptureFrame()); | 
| 239 } else { | 302 } else { | 
| 240 PostCaptureCompleted(scoped_refptr<media::ScreenCaptureData>()); | 303 PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame>()); | 
| 241 } | 304 } | 
| 242 } | 305 } | 
| 243 | 306 | 
| 244 void DesktopSessionProxy::SetVideoCapturer( | 307 void DesktopSessionProxy::SetVideoCapturer( | 
| 245 const base::WeakPtr<IpcVideoFrameCapturer> video_capturer) { | 308 const base::WeakPtr<IpcVideoFrameCapturer> video_capturer) { | 
| 246 DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); | 309 DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); | 
| 247 | 310 | 
| 248 video_capturer_ = video_capturer; | 311 video_capturer_ = video_capturer; | 
| 249 } | 312 } | 
| 250 | 313 | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 363 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 
| 301 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 364 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 302 | 365 | 
| 303 client_clipboard_ = client_clipboard.Pass(); | 366 client_clipboard_ = client_clipboard.Pass(); | 
| 304 } | 367 } | 
| 305 | 368 | 
| 306 void DesktopSessionProxy::SetScreenResolution( | 369 void DesktopSessionProxy::SetScreenResolution( | 
| 307 const ScreenResolution& resolution) { | 370 const ScreenResolution& resolution) { | 
| 308 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 371 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 309 | 372 | 
| 310 if (!resolution.IsValid()) | 373 if (!resolution.IsEmpty()) | 
| 311 return; | 374 return; | 
| 312 | 375 | 
| 313 screen_resolution_ = resolution; | 376 screen_resolution_ = resolution; | 
| 314 | 377 | 
| 315 // Connect to the desktop session if it is not done yet. | 378 // Connect to the desktop session if it is not done yet. | 
| 316 if (!is_desktop_session_connected_) { | 379 if (!is_desktop_session_connected_) { | 
| 317 is_desktop_session_connected_ = true; | 380 is_desktop_session_connected_ = true; | 
| 318 if (desktop_session_connector_) { | 381 if (desktop_session_connector_) { | 
| 319 desktop_session_connector_->ConnectTerminal(this, screen_resolution_, | 382 desktop_session_connector_->ConnectTerminal(this, screen_resolution_, | 
| 320 virtual_terminal_); | 383 virtual_terminal_); | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 337 | 400 | 
| 338 if (desktop_session_connector_ && is_desktop_session_connected_) | 401 if (desktop_session_connector_ && is_desktop_session_connected_) | 
| 339 desktop_session_connector_->DisconnectTerminal(this); | 402 desktop_session_connector_->DisconnectTerminal(this); | 
| 340 | 403 | 
| 341 if (desktop_process_ != base::kNullProcessHandle) { | 404 if (desktop_process_ != base::kNullProcessHandle) { | 
| 342 base::CloseProcessHandle(desktop_process_); | 405 base::CloseProcessHandle(desktop_process_); | 
| 343 desktop_process_ = base::kNullProcessHandle; | 406 desktop_process_ = base::kNullProcessHandle; | 
| 344 } | 407 } | 
| 345 } | 408 } | 
| 346 | 409 | 
| 347 scoped_refptr<media::SharedBuffer> DesktopSessionProxy::GetSharedBuffer( | 410 scoped_refptr<DesktopSessionProxy::IpcSharedBufferCore> | 
| 348 int id) { | 411 DesktopSessionProxy::GetSharedBufferCore(int id) { | 
| 349 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 412 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 350 | 413 | 
| 351 SharedBuffers::const_iterator i = shared_buffers_.find(id); | 414 SharedBuffers::const_iterator i = shared_buffers_.find(id); | 
| 352 if (i != shared_buffers_.end()) { | 415 if (i != shared_buffers_.end()) { | 
| 353 return i->second; | 416 return i->second; | 
| 354 } else { | 417 } else { | 
| 355 LOG(ERROR) << "Failed to find the shared buffer " << id; | 418 LOG(ERROR) << "Failed to find the shared buffer " << id; | 
| 356 return scoped_refptr<media::SharedBuffer>(); | 419 return NULL; | 
| 357 } | 420 } | 
| 358 } | 421 } | 
| 359 | 422 | 
| 360 void DesktopSessionProxy::OnAudioPacket(const std::string& serialized_packet) { | 423 void DesktopSessionProxy::OnAudioPacket(const std::string& serialized_packet) { | 
| 361 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 424 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 362 | 425 | 
| 363 // Parse a serialized audio packet. No further validation is done since | 426 // Parse a serialized audio packet. No further validation is done since | 
| 364 // the message was sent by more privileged process. | 427 // the message was sent by more privileged process. | 
| 365 scoped_ptr<AudioPacket> packet(new AudioPacket()); | 428 scoped_ptr<AudioPacket> packet(new AudioPacket()); | 
| 366 if (!packet->ParseFromString(serialized_packet)) { | 429 if (!packet->ParseFromString(serialized_packet)) { | 
| 367 LOG(ERROR) << "Failed to parse AudioPacket."; | 430 LOG(ERROR) << "Failed to parse AudioPacket."; | 
| 368 return; | 431 return; | 
| 369 } | 432 } | 
| 370 | 433 | 
| 371 // Pass a captured audio packet to |audio_capturer_|. | 434 // Pass a captured audio packet to |audio_capturer_|. | 
| 372 audio_capture_task_runner_->PostTask( | 435 audio_capture_task_runner_->PostTask( | 
| 373 FROM_HERE, base::Bind(&IpcAudioCapturer::OnAudioPacket, audio_capturer_, | 436 FROM_HERE, base::Bind(&IpcAudioCapturer::OnAudioPacket, audio_capturer_, | 
| 374 base::Passed(&packet))); | 437 base::Passed(&packet))); | 
| 375 } | 438 } | 
| 376 | 439 | 
| 377 void DesktopSessionProxy::OnCreateSharedBuffer( | 440 void DesktopSessionProxy::OnCreateSharedBuffer( | 
| 378 int id, | 441 int id, | 
| 379 IPC::PlatformFileForTransit handle, | 442 IPC::PlatformFileForTransit handle, | 
| 380 uint32 size) { | 443 uint32 size) { | 
| 381 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 444 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 382 | 445 | 
| 383 scoped_refptr<media::SharedBuffer> shared_buffer; | 446 scoped_refptr<IpcSharedBufferCore> shared_buffer; | 
| 384 | 447 | 
| 385 #if defined(OS_WIN) | 448 #if defined(OS_WIN) | 
| 386 shared_buffer = new media::SharedBuffer(id, handle, desktop_process_, size); | 449 shared_buffer = new IpcSharedBufferCore(id, handle, desktop_process_, size); | 
| 387 #elif defined(OS_POSIX) | 450 #elif defined(OS_POSIX) | 
| 388 shared_buffer = new media::SharedBuffer(id, handle, size); | 451 shared_buffer = new IpcSharedBufferCore(id, handle, size); | 
| 389 #else | 452 #else | 
| 390 #error Unsupported platform. | 453 #error Unsupported platform. | 
| 391 #endif | 454 #endif | 
| 392 | 455 | 
| 393 // Check if the buffer has been successfully mapped. | 456 // Check if the buffer has been successfully mapped. | 
| 394 bool mapped = shared_buffer->ptr() != NULL; | 457 bool mapped = shared_buffer->memory() != NULL; | 
| 395 if (!mapped) { | 458 if (!mapped) { | 
| 396 #if defined(OS_WIN) | 459 #if defined(OS_WIN) | 
| 397 LOG(ERROR) << "Failed to map a shared buffer: id=" << id | 460 LOG(ERROR) << "Failed to map a shared buffer: id=" << id | 
| 
 
alexeypa (please no reviews)
2013/05/13 17:02:00
nit: Move the logging statements to IpcSharedBuffe
 
Sergey Ulanov
2013/05/13 21:16:52
Done.
 
 | |
| 398 << ", handle=" << handle | 461 << ", handle=" << handle | 
| 399 << ", size=" << size; | 462 << ", size=" << size; | 
| 400 #elif defined(OS_POSIX) | 463 #elif defined(OS_POSIX) | 
| 401 LOG(ERROR) << "Failed to map a shared buffer: id=" << id | 464 LOG(ERROR) << "Failed to map a shared buffer: id=" << id | 
| 402 << ", handle.fd=" << handle.fd | 465 << ", handle.fd=" << handle.fd | 
| 403 << ", size=" << size; | 466 << ", size=" << size; | 
| 404 #endif | 467 #endif | 
| 405 } | 468 } | 
| 406 | 469 | 
| 407 if (mapped && | 470 if (mapped && | 
| 408 !shared_buffers_.insert(std::make_pair(id, shared_buffer)).second) { | 471 !shared_buffers_.insert(std::make_pair(id, shared_buffer)).second) { | 
| 409 LOG(ERROR) << "Duplicate shared buffer id " << id << " encountered"; | 472 LOG(ERROR) << "Duplicate shared buffer id " << id << " encountered"; | 
| 410 } | 473 } | 
| 411 | |
| 412 // Notify the desktop process that the buffer has been seen and can now be | |
| 413 // safely deleted if needed. | |
| 414 SendToDesktop(new ChromotingNetworkDesktopMsg_SharedBufferCreated(id)); | |
| 415 } | 474 } | 
| 416 | 475 | 
| 417 void DesktopSessionProxy::OnReleaseSharedBuffer(int id) { | 476 void DesktopSessionProxy::OnReleaseSharedBuffer(int id) { | 
| 418 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 477 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 419 | 478 | 
| 420 // Drop the cached reference to the buffer. | 479 // Drop the cached reference to the buffer. | 
| 421 shared_buffers_.erase(id); | 480 shared_buffers_.erase(id); | 
| 422 } | 481 } | 
| 423 | 482 | 
| 424 void DesktopSessionProxy::OnCaptureCompleted( | 483 void DesktopSessionProxy::OnCaptureCompleted( | 
| 425 const SerializedCapturedData& serialized_data) { | 484 const SerializedDesktopFrame& serialized_frame) { | 
| 426 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 485 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 427 | 486 | 
| 428 // Assume that |serialized_data| is well formed because it was received from | 487 // Assume that |serialized_frame| is well-formed because it was received from | 
| 429 // a more privileged process. | 488 // a more privileged process. | 
| 430 scoped_refptr<media::ScreenCaptureData> capture_data; | 489 scoped_refptr<IpcSharedBufferCore> shared_buffer_core = | 
| 431 scoped_refptr<media::SharedBuffer> shared_buffer = | 490 GetSharedBufferCore(serialized_frame.shared_buffer_id); | 
| 432 GetSharedBuffer(serialized_data.shared_buffer_id); | 491 CHECK(shared_buffer_core); | 
| 433 CHECK(shared_buffer); | |
| 434 | 492 | 
| 435 capture_data = new media::ScreenCaptureData( | 493 scoped_ptr<webrtc::DesktopFrame> frame( | 
| 436 reinterpret_cast<uint8*>(shared_buffer->ptr()), | 494 new webrtc::SharedMemoryDesktopFrame( | 
| 437 serialized_data.bytes_per_row, | 495 serialized_frame.dimensions, serialized_frame.bytes_per_row, | 
| 438 serialized_data.dimensions); | 496 new IpcSharedBuffer(shared_buffer_core))); | 
| 439 capture_data->set_capture_time_ms(serialized_data.capture_time_ms); | 497 frame->set_capture_time_ms(serialized_frame.capture_time_ms); | 
| 440 capture_data->set_client_sequence_number( | 498 frame->set_dpi(serialized_frame.dpi); | 
| 441 serialized_data.client_sequence_number); | |
| 442 capture_data->set_dpi(serialized_data.dpi); | |
| 443 capture_data->set_shared_buffer(shared_buffer); | |
| 444 | 499 | 
| 445 if (!serialized_data.dirty_region.empty()) { | 500 for (size_t i = 0; i < serialized_frame.dirty_region.size(); ++i) { | 
| 446 capture_data->mutable_dirty_region().setRects( | 501 frame->mutable_updated_region()->AddRect(serialized_frame.dirty_region[i]); | 
| 447 &serialized_data.dirty_region[0], | |
| 448 serialized_data.dirty_region.size()); | |
| 449 } | 502 } | 
| 450 | 503 | 
| 451 --pending_capture_frame_requests_; | 504 --pending_capture_frame_requests_; | 
| 452 PostCaptureCompleted(capture_data); | 505 PostCaptureCompleted(frame.Pass()); | 
| 453 } | 506 } | 
| 454 | 507 | 
| 455 void DesktopSessionProxy::OnCursorShapeChanged( | 508 void DesktopSessionProxy::OnCursorShapeChanged( | 
| 456 const media::MouseCursorShape& cursor_shape) { | 509 const media::MouseCursorShape& cursor_shape) { | 
| 457 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 510 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 458 PostCursorShape(scoped_ptr<media::MouseCursorShape>( | 511 PostCursorShape(scoped_ptr<media::MouseCursorShape>( | 
| 459 new media::MouseCursorShape(cursor_shape))); | 512 new media::MouseCursorShape(cursor_shape))); | 
| 460 } | 513 } | 
| 461 | 514 | 
| 462 void DesktopSessionProxy::OnInjectClipboardEvent( | 515 void DesktopSessionProxy::OnInjectClipboardEvent( | 
| 463 const std::string& serialized_event) { | 516 const std::string& serialized_event) { | 
| 464 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 517 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 465 | 518 | 
| 466 if (client_clipboard_) { | 519 if (client_clipboard_) { | 
| 467 protocol::ClipboardEvent event; | 520 protocol::ClipboardEvent event; | 
| 468 if (!event.ParseFromString(serialized_event)) { | 521 if (!event.ParseFromString(serialized_event)) { | 
| 469 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; | 522 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; | 
| 470 return; | 523 return; | 
| 471 } | 524 } | 
| 472 | 525 | 
| 473 client_clipboard_->InjectClipboardEvent(event); | 526 client_clipboard_->InjectClipboardEvent(event); | 
| 474 } | 527 } | 
| 475 } | 528 } | 
| 476 | 529 | 
| 477 void DesktopSessionProxy::PostCaptureCompleted( | 530 void DesktopSessionProxy::PostCaptureCompleted( | 
| 478 scoped_refptr<media::ScreenCaptureData> capture_data) { | 531 scoped_ptr<webrtc::DesktopFrame> frame) { | 
| 479 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 532 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 480 | 533 | 
| 481 video_capture_task_runner_->PostTask( | 534 video_capture_task_runner_->PostTask( | 
| 482 FROM_HERE, | 535 FROM_HERE, | 
| 483 base::Bind(&IpcVideoFrameCapturer::OnCaptureCompleted, video_capturer_, | 536 base::Bind(&IpcVideoFrameCapturer::OnCaptureCompleted, video_capturer_, | 
| 484 capture_data)); | 537 base::Passed(&frame))); | 
| 485 } | 538 } | 
| 486 | 539 | 
| 487 void DesktopSessionProxy::PostCursorShape( | 540 void DesktopSessionProxy::PostCursorShape( | 
| 488 scoped_ptr<media::MouseCursorShape> cursor_shape) { | 541 scoped_ptr<media::MouseCursorShape> cursor_shape) { | 
| 489 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 542 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 
| 490 | 543 | 
| 491 video_capture_task_runner_->PostTask( | 544 video_capture_task_runner_->PostTask( | 
| 492 FROM_HERE, | 545 FROM_HERE, | 
| 493 base::Bind(&IpcVideoFrameCapturer::OnCursorShapeChanged, video_capturer_, | 546 base::Bind(&IpcVideoFrameCapturer::OnCursorShapeChanged, video_capturer_, | 
| 494 base::Passed(&cursor_shape))); | 547 base::Passed(&cursor_shape))); | 
| (...skipping 10 matching lines...) Expand all Loading... | |
| 505 } | 558 } | 
| 506 | 559 | 
| 507 // static | 560 // static | 
| 508 void DesktopSessionProxyTraits::Destruct( | 561 void DesktopSessionProxyTraits::Destruct( | 
| 509 const DesktopSessionProxy* desktop_session_proxy) { | 562 const DesktopSessionProxy* desktop_session_proxy) { | 
| 510 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 563 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 
| 511 desktop_session_proxy); | 564 desktop_session_proxy); | 
| 512 } | 565 } | 
| 513 | 566 | 
| 514 } // namespace remoting | 567 } // namespace remoting | 
| OLD | NEW |