summaryrefslogtreecommitdiffstats
path: root/remoting/host/desktop_session_proxy.cc
diff options
context:
space:
mode:
authordcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-08 06:33:50 +0000
committerdcaiafa@chromium.org <dcaiafa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-08 06:35:01 +0000
commit20013200c233df4c0720a9bab287001e36c3c2c1 (patch)
tree29d381c1c4c464e3c230e983f024312b2adb8cd1 /remoting/host/desktop_session_proxy.cc
parentd6907a5c07058d610578824939b08e1e78337370 (diff)
downloadchromium_src-20013200c233df4c0720a9bab287001e36c3c2c1.zip
chromium_src-20013200c233df4c0720a9bab287001e36c3c2c1.tar.gz
chromium_src-20013200c233df4c0720a9bab287001e36c3c2c1.tar.bz2
Use webrtc::MouseCursorMonitor for cursor shapes
Use webrtc::MouseCursorMonitor for cursor shapes instead of webrtc::VideoFrameCapturer, in preparation for deprecating cursor shape functionality in the latter. Fix memory corruption in VideoSchedulerTests_StartAndStop, where a lingering capture task could trigger a expectation action declared on the stack during tear down. My changes to the test somehow made the race condition more likely. BUG=324033 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=247689 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=248045 Review URL: https://codereview.chromium.org/92473002 Cr-Commit-Position: refs/heads/master@{#288226} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/desktop_session_proxy.cc')
-rw-r--r--remoting/host/desktop_session_proxy.cc36
1 files changed, 26 insertions, 10 deletions
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 7904a2d..5094a77 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -18,6 +18,7 @@
#include "remoting/host/desktop_session_connector.h"
#include "remoting/host/ipc_audio_capturer.h"
#include "remoting/host/ipc_input_injector.h"
+#include "remoting/host/ipc_mouse_cursor_monitor.h"
#include "remoting/host/ipc_screen_controls.h"
#include "remoting/host/ipc_video_frame_capturer.h"
#include "remoting/proto/audio.pb.h"
@@ -25,6 +26,7 @@
#include "remoting/proto/event.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
+#include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
#include "third_party/webrtc/modules/desktop_capture/shared_memory.h"
#if defined(OS_WIN)
@@ -143,6 +145,12 @@ scoped_ptr<webrtc::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() {
return scoped_ptr<webrtc::ScreenCapturer>(new IpcVideoFrameCapturer(this));
}
+scoped_ptr<webrtc::MouseCursorMonitor>
+ DesktopSessionProxy::CreateMouseCursorMonitor() {
+ return scoped_ptr<webrtc::MouseCursorMonitor>(
+ new IpcMouseCursorMonitor(this));
+}
+
std::string DesktopSessionProxy::GetCapabilities() const {
std::string result = kRateLimitResizeRequests;
// Ask the client to send its resolution unconditionally.
@@ -182,8 +190,8 @@ bool DesktopSessionProxy::OnMessageReceived(const IPC::Message& message) {
OnAudioPacket)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CaptureCompleted,
OnCaptureCompleted)
- IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CursorShapeChanged,
- OnCursorShapeChanged)
+ IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_MouseCursor,
+ OnMouseCursor)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CreateSharedBuffer,
OnCreateSharedBuffer)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_ReleaseSharedBuffer,
@@ -316,6 +324,13 @@ void DesktopSessionProxy::SetVideoCapturer(
video_capturer_ = video_capturer;
}
+void DesktopSessionProxy::SetMouseCursorMonitor(
+ const base::WeakPtr<IpcMouseCursorMonitor>& mouse_cursor_monitor) {
+ DCHECK(video_capture_task_runner_->BelongsToCurrentThread());
+
+ mouse_cursor_monitor_ = mouse_cursor_monitor;
+}
+
void DesktopSessionProxy::DisconnectSession() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
@@ -502,11 +517,12 @@ void DesktopSessionProxy::OnCaptureCompleted(
PostCaptureCompleted(frame.Pass());
}
-void DesktopSessionProxy::OnCursorShapeChanged(
- const webrtc::MouseCursorShape& cursor_shape) {
+void DesktopSessionProxy::OnMouseCursor(
+ const webrtc::MouseCursor& mouse_cursor) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
- PostCursorShape(scoped_ptr<webrtc::MouseCursorShape>(
- new webrtc::MouseCursorShape(cursor_shape)));
+ scoped_ptr<webrtc::MouseCursor> cursor(
+ webrtc::MouseCursor::CopyOf(mouse_cursor));
+ PostMouseCursor(cursor.Pass());
}
void DesktopSessionProxy::OnInjectClipboardEvent(
@@ -534,14 +550,14 @@ void DesktopSessionProxy::PostCaptureCompleted(
base::Passed(&frame)));
}
-void DesktopSessionProxy::PostCursorShape(
- scoped_ptr<webrtc::MouseCursorShape> cursor_shape) {
+void DesktopSessionProxy::PostMouseCursor(
+ scoped_ptr<webrtc::MouseCursor> mouse_cursor) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
video_capture_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&IpcVideoFrameCapturer::OnCursorShapeChanged, video_capturer_,
- base::Passed(&cursor_shape)));
+ base::Bind(&IpcMouseCursorMonitor::OnMouseCursor, mouse_cursor_monitor_,
+ base::Passed(&mouse_cursor)));
}
void DesktopSessionProxy::SendToDesktop(IPC::Message* message) {