diff options
author | sergeyu <sergeyu@chromium.org> | 2016-02-14 21:59:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-15 06:02:01 +0000 |
commit | 85df3c48fd4a3be69b1a650cebc793024d4879b3 (patch) | |
tree | 8244405ef9eb58f7bcf37f38d9a85f8128cbfa97 /remoting/host/desktop_session_proxy.cc | |
parent | fce78a10f007fe04532eb1326aba92f9c32b7a22 (diff) | |
download | chromium_src-85df3c48fd4a3be69b1a650cebc793024d4879b3.zip chromium_src-85df3c48fd4a3be69b1a650cebc793024d4879b3.tar.gz chromium_src-85df3c48fd4a3be69b1a650cebc793024d4879b3.tar.bz2 |
Use IpcVideoFrameCapturer on network thread instead of capture thread.
Previously IpcVideoFrameCapturer was called on the capturer thread,
while all IPC messages are sent and received on the network thread. Now
DesktopEnvironment implementations are responsible for creation of
DesktopCapturerProxy and MouseCursorMonitorProxy if necessary. This
allows to avoid capture thread on windows in the network process.
Also cleaned up unnecessary references to various task runners from
ChromotingHost and ClientSession.
BUG=458437
Review URL: https://codereview.chromium.org/1673723002
Cr-Commit-Position: refs/heads/master@{#375412}
Diffstat (limited to 'remoting/host/desktop_session_proxy.cc')
-rw-r--r-- | remoting/host/desktop_session_proxy.cc | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index a7bfdba..4dbe639 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -90,7 +90,6 @@ DesktopSessionProxy::DesktopSessionProxy( scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, base::WeakPtr<ClientSessionControl> client_session_control, base::WeakPtr<DesktopSessionConnector> desktop_session_connector, bool virtual_terminal, @@ -98,7 +97,6 @@ DesktopSessionProxy::DesktopSessionProxy( : audio_capture_task_runner_(audio_capture_task_runner), caller_task_runner_(caller_task_runner), io_task_runner_(io_task_runner), - video_capture_task_runner_(video_capture_task_runner), client_session_control_(client_session_control), desktop_session_connector_(desktop_session_connector), pending_capture_frame_requests_(0), @@ -276,7 +274,7 @@ void DesktopSessionProxy::DetachFromDesktop() { // Generate fake responses to keep the video capturer in sync. while (pending_capture_frame_requests_) { --pending_capture_frame_requests_; - PostCaptureCompleted(nullptr); + video_capturer_->OnCaptureCompleted(nullptr); } } @@ -288,30 +286,26 @@ void DesktopSessionProxy::SetAudioCapturer( } void DesktopSessionProxy::CaptureFrame() { - if (!caller_task_runner_->BelongsToCurrentThread()) { - caller_task_runner_->PostTask( - FROM_HERE, base::Bind(&DesktopSessionProxy::CaptureFrame, this)); - return; - } + DCHECK(caller_task_runner_->BelongsToCurrentThread()); if (desktop_channel_) { ++pending_capture_frame_requests_; SendToDesktop(new ChromotingNetworkDesktopMsg_CaptureFrame()); } else { - PostCaptureCompleted(nullptr); + video_capturer_->OnCaptureCompleted(nullptr); } } void DesktopSessionProxy::SetVideoCapturer( const base::WeakPtr<IpcVideoFrameCapturer> video_capturer) { - DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); + DCHECK(caller_task_runner_->BelongsToCurrentThread()); video_capturer_ = video_capturer; } void DesktopSessionProxy::SetMouseCursorMonitor( const base::WeakPtr<IpcMouseCursorMonitor>& mouse_cursor_monitor) { - DCHECK(video_capture_task_runner_->BelongsToCurrentThread()); + DCHECK(caller_task_runner_->BelongsToCurrentThread()); mouse_cursor_monitor_ = mouse_cursor_monitor; } @@ -507,13 +501,17 @@ void DesktopSessionProxy::OnCaptureCompleted( } --pending_capture_frame_requests_; - PostCaptureCompleted(std::move(frame)); + video_capturer_->OnCaptureCompleted(std::move(frame)); } void DesktopSessionProxy::OnMouseCursor( const webrtc::MouseCursor& mouse_cursor) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - PostMouseCursor(make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor))); + + if (mouse_cursor_monitor_) { + mouse_cursor_monitor_->OnMouseCursor( + make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor))); + } } void DesktopSessionProxy::OnInjectClipboardEvent( @@ -531,26 +529,6 @@ void DesktopSessionProxy::OnInjectClipboardEvent( } } -void DesktopSessionProxy::PostCaptureCompleted( - scoped_ptr<webrtc::DesktopFrame> frame) { - DCHECK(caller_task_runner_->BelongsToCurrentThread()); - - video_capture_task_runner_->PostTask( - FROM_HERE, - base::Bind(&IpcVideoFrameCapturer::OnCaptureCompleted, video_capturer_, - base::Passed(&frame))); -} - -void DesktopSessionProxy::PostMouseCursor( - scoped_ptr<webrtc::MouseCursor> mouse_cursor) { - DCHECK(caller_task_runner_->BelongsToCurrentThread()); - - video_capture_task_runner_->PostTask( - FROM_HERE, - base::Bind(&IpcMouseCursorMonitor::OnMouseCursor, mouse_cursor_monitor_, - base::Passed(&mouse_cursor))); -} - void DesktopSessionProxy::SendToDesktop(IPC::Message* message) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); |