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

Unified Diff: remoting/android/java/src/org/chromium/chromoting/jni/Display.java

Issue 2100943004: [Remoting Android] Make JniClient own JniDisplayHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 6 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/android/java/src/org/chromium/chromoting/jni/Client.java ('k') | remoting/client/jni/jni_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/android/java/src/org/chromium/chromoting/jni/Display.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/Display.java b/remoting/android/java/src/org/chromium/chromoting/jni/Display.java
index 5b6d4f421b69c5e8cd4304535b34f147d31ca2f9..d496207ee155499be63fb67080d6af306076faf8 100644
--- a/remoting/android/java/src/org/chromium/chromoting/jni/Display.java
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/Display.java
@@ -51,8 +51,8 @@ public class Display {
/** Bitmap holding the cursor shape. Accessed on the graphics thread. */
private Bitmap mCursorBitmap;
- public Display() {
- mNativeJniDisplayHandler = nativeInit();
+ private Display(long nativeDisplayHandler) {
+ mNativeJniDisplayHandler = nativeDisplayHandler;
}
/**
@@ -74,16 +74,17 @@ public class Display {
}
/**
- * Destroys its resources and the native counterpart. Called on the UI thread.
+ * Invalidates this object and disconnects from the native display handler. Called on the
+ * display thread by the native code.
*/
- public void destroy() {
+ @CalledByNative
+ private void invalidate() {
// Drop the reference to free the Bitmap for GC.
synchronized (mFrameLock) {
mFrameBitmap = null;
}
provideRedrawCallback(null);
- nativeDestroy(mNativeJniDisplayHandler);
mNativeJniDisplayHandler = 0;
}
@@ -171,9 +172,10 @@ public class Display {
return mCursorBitmap;
}
- private native long nativeInit();
-
- private native void nativeDestroy(long nativeJniDisplayHandler);
+ @CalledByNative
+ private static Display createJavaDisplayObject(long nativeDisplayHandler) {
+ return new Display(nativeDisplayHandler);
+ }
/** Schedules a redraw on the native graphics thread. */
private native void nativeScheduleRedraw(long nativeJniDisplayHandler);
« no previous file with comments | « remoting/android/java/src/org/chromium/chromoting/jni/Client.java ('k') | remoting/client/jni/jni_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698