Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: remoting/host/screen_recorder.cc

Issue 10382184: [Chromoting] Initial plumbing for cursor shape. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call SetCursor only for native format images Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index ab96a53708cf35a6c6db14f1e7d1fea6ef8635ff..330d66cc132160702633117504c44f709541cc1d 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -16,8 +16,10 @@
#include "base/time.h"
#include "remoting/base/capture_data.h"
#include "remoting/proto/control.pb.h"
+#include "remoting/proto/internal.pb.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/client_stub.h"
+#include "remoting/protocol/cursor_shape_stub.h"
#include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/message_decoder.h"
#include "remoting/protocol/util.h"
@@ -142,7 +144,9 @@ void ScreenRecorder::DoStart() {
return;
}
- capturer()->Start();
+ capturer()->Start(
+ base::Bind(&ScreenRecorder::CursorShapeChangedCallback, this));
+
capture_timer_.reset(new base::OneShotTimer<ScreenRecorder>());
// Capture first frame immedately.
@@ -214,6 +218,18 @@ void ScreenRecorder::CaptureDoneCallback(
FROM_HERE, base::Bind(&ScreenRecorder::DoEncode, this, capture_data));
}
+void ScreenRecorder::CursorShapeChangedCallback(
+ scoped_ptr<protocol::CursorShapeInfo> cursor_data) {
+ DCHECK_EQ(capture_loop_, MessageLoop::current());
+
+ if (!is_recording())
+ return;
+
+ encode_loop_->PostTask(
+ FROM_HERE, base::Bind(&ScreenRecorder::DoEncodeCursorShape,
Wez 2012/05/29 18:02:54 You can skip directly to DoSendCursorShape here ..
garykac 2012/05/30 23:22:45 Done.
+ this, base::Passed(cursor_data.Pass())));
+}
+
void ScreenRecorder::DoFinishOneRecording() {
DCHECK_EQ(capture_loop_, MessageLoop::current());
@@ -281,6 +297,18 @@ void ScreenRecorder::DoStopOnNetworkThread(const base::Closure& done_task) {
this, done_task));
}
+void ScreenRecorder::DoSendCursorShape(
+ scoped_ptr<protocol::CursorShapeInfo> cursor_shape) {
+ DCHECK(network_loop_->BelongsToCurrentThread());
+
+ if (network_stopped_ || connections_.empty())
+ return;
+
+ // TODO(sergeyu): Currently we send the data only to the first
+ // connection. Send it to all connections if necessary.
+ connections_.front()->cursor_shape_stub()->SetCursorShape(*cursor_shape);
+}
+
// Encoder thread --------------------------------------------------------------
void ScreenRecorder::DoEncode(
@@ -307,6 +335,15 @@ void ScreenRecorder::DoEncode(
base::Bind(&ScreenRecorder::EncodedDataAvailableCallback, this));
}
+void ScreenRecorder::DoEncodeCursorShape(
Wez 2012/05/29 18:02:54 ... and remove this method entirely. :)
garykac 2012/05/30 23:22:45 Done.
+ scoped_ptr<protocol::CursorShapeInfo> cursor) {
+ DCHECK_EQ(encode_loop_, MessageLoop::current());
+
+ network_loop_->PostTask(
+ FROM_HERE, base::Bind(&ScreenRecorder::DoSendCursorShape, this,
+ base::Passed(cursor.Pass())));
+}
+
void ScreenRecorder::DoStopOnEncodeThread(const base::Closure& done_task) {
DCHECK_EQ(encode_loop_, MessageLoop::current());
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698