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); |