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

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

Issue 2007123003: [Android Client] Break down multi-threaded classes by thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename JniSecretFetcher to JniPairingSecretFetcher Created 4 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/client/jni/jni_client.cc ('k') | remoting/client/jni/jni_display_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/jni_display_handler.h
diff --git a/remoting/client/jni/jni_display_handler.h b/remoting/client/jni/jni_display_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..d54cfa4a8292287978caf57bbe0e78f4519fd1c0
--- /dev/null
+++ b/remoting/client/jni/jni_display_handler.h
@@ -0,0 +1,66 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_
+#define REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "remoting/proto/control.pb.h"
+
+namespace remoting {
+
+// Handles display operations. Must be called and deleted on the display thread
+// unless otherwise noted.
+class JniDisplayHandler {
+ public:
+ JniDisplayHandler(scoped_refptr<base::SingleThreadTaskRunner> display_runner,
+ base::android::ScopedJavaGlobalRef<jobject> java_display);
+
+ // Must be deleted on the display thread.
+ ~JniDisplayHandler();
+
+ // Creates a new Bitmap object to store a video frame. Can be called on any
+ // thread.
+ static base::android::ScopedJavaLocalRef<jobject> NewBitmap(int width,
+ int height);
+
+ // Updates video frame bitmap. |bitmap| must be an instance of
+ // android.graphics.Bitmap.
+ void UpdateFrameBitmap(base::android::ScopedJavaGlobalRef<jobject> bitmap);
+
+ // Updates cursor shape.
+ void UpdateCursorShape(const protocol::CursorShapeInfo& cursor_shape);
+
+ // Draws the latest image buffer onto the canvas.
+ void RedrawCanvas();
+
+ // Returns a display thread weak pointer to the object.
+ base::WeakPtr<JniDisplayHandler> GetWeakPtr();
+
+ static bool RegisterJni(JNIEnv* env);
+
+ // Deletes this object on display thread. Can be called on any thread.
+ void Destroy(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& caller);
+
+ // Schedule redraw. Can be called on any thread.
+ void ScheduleRedraw(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& caller);
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> display_runner_;
+
+ base::android::ScopedJavaGlobalRef<jobject> java_display_;
+ base::WeakPtrFactory<JniDisplayHandler> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(JniDisplayHandler);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_
« no previous file with comments | « remoting/client/jni/jni_client.cc ('k') | remoting/client/jni/jni_display_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698