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

Unified Diff: remoting/client/jni/jni_display_handler.cc

Issue 2187723002: [Remoting Android] Refactor CursorShapeStubProxy from JniDisplayHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor style fix Created 4 years, 5 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
Index: remoting/client/jni/jni_display_handler.cc
diff --git a/remoting/client/jni/jni_display_handler.cc b/remoting/client/jni/jni_display_handler.cc
index e139e7bc3ab7578af1345d9402a27e9e3a595c42..bf26e28225a0465dfb1518f77fd19a26414ee0e0 100644
--- a/remoting/client/jni/jni_display_handler.cc
+++ b/remoting/client/jni/jni_display_handler.cc
@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "jni/Display_jni.h"
+#include "remoting/client/callback_cursor_shape_stub.h"
#include "remoting/client/jni/chromoting_jni_runtime.h"
#include "remoting/client/jni/jni_client.h"
#include "remoting/client/jni/jni_video_renderer.h"
@@ -24,33 +25,6 @@ const int kBytesPerPixel = 4;
namespace remoting {
-// CursorShapeStub with a lifetime separated from JniDisplayHandler.
-class DisplayCursorShapeStub : public protocol::CursorShapeStub {
- public:
- DisplayCursorShapeStub(
- base::WeakPtr<JniDisplayHandler> display,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
- void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
- private:
- base::WeakPtr<JniDisplayHandler> display_handler_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-};
-
-DisplayCursorShapeStub::DisplayCursorShapeStub(
- base::WeakPtr<JniDisplayHandler> display,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) :
- display_handler_(display),
- task_runner_(task_runner) {
-}
-
-void DisplayCursorShapeStub::SetCursorShape(
- const protocol::CursorShapeInfo& cursor_shape) {
- task_runner_->PostTask(FROM_HERE,
- base::Bind(&JniDisplayHandler::UpdateCursorShape,
- display_handler_,
- cursor_shape));
-}
-
// JniDisplayHandler definitions.
JniDisplayHandler::JniDisplayHandler(ChromotingJniRuntime* runtime)
: runtime_(runtime),
@@ -95,8 +69,9 @@ void JniDisplayHandler::UpdateCursorShape(
std::unique_ptr<protocol::CursorShapeStub>
JniDisplayHandler::CreateCursorShapeStub() {
- return base::WrapUnique(
- new DisplayCursorShapeStub(weak_ptr_, runtime_->display_task_runner()));
+ return base::WrapUnique(new CallbackCursorShapeStub(
+ base::Bind(&JniDisplayHandler::UpdateCursorShape, weak_ptr_),
+ runtime_->display_task_runner()));
}
std::unique_ptr<protocol::VideoRenderer>

Powered by Google App Engine
This is Rietveld 408576698