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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/jni/GlDisplay.java

Issue 2338473002: [Remoting Android] JniGlDisplayHandler calls invalidate() on UI thread (Closed)
Patch Set: Reviewer's Feedback Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chromoting.jni; 5 package org.chromium.chromoting.jni;
6 6
7 import android.graphics.Matrix; 7 import android.graphics.Matrix;
8 import android.graphics.PointF; 8 import android.graphics.PointF;
9 import android.view.Surface; 9 import android.view.Surface;
10 import android.view.SurfaceHolder; 10 import android.view.SurfaceHolder;
11 11
12 import org.chromium.base.annotations.CalledByNative; 12 import org.chromium.base.annotations.CalledByNative;
13 import org.chromium.base.annotations.JNINamespace; 13 import org.chromium.base.annotations.JNINamespace;
14 import org.chromium.chromoting.Desktop; 14 import org.chromium.chromoting.Desktop;
15 import org.chromium.chromoting.DesktopView; 15 import org.chromium.chromoting.DesktopView;
16 import org.chromium.chromoting.DesktopViewFactory; 16 import org.chromium.chromoting.DesktopViewFactory;
17 import org.chromium.chromoting.Event; 17 import org.chromium.chromoting.Event;
18 import org.chromium.chromoting.GlDesktopView; 18 import org.chromium.chromoting.GlDesktopView;
19 import org.chromium.chromoting.InputFeedbackRadiusMapper; 19 import org.chromium.chromoting.InputFeedbackRadiusMapper;
20 import org.chromium.chromoting.RenderStub; 20 import org.chromium.chromoting.RenderStub;
21 import org.chromium.chromoting.SizeChangedEventParameter; 21 import org.chromium.chromoting.SizeChangedEventParameter;
22 22
23 /** 23 /**
24 * This class is the JNI interface class that helps bridging GlDesktopView with the OpenGL renderer 24 * This class is the JNI interface class that helps bridging GlDesktopView with the OpenGL renderer
25 * in native code. The lifetime of this class is managed by the native JniGlDisp layHandler. 25 * in native code. The lifetime of this class is managed by the native JniGlDisp layHandler.
26 * 26 *
27 * This class works entirely on the UI thread: 27 * This class works entirely on the UI thread:
28 * Functions should all be called on UI. 28 * Functions should all be called on UI.
29 * Events will only be triggered on UI. 29 * Callbacks by native counterpart are called on UI.
30 */ 30 */
31 @JNINamespace("remoting") 31 @JNINamespace("remoting")
32 public class GlDisplay implements SurfaceHolder.Callback, RenderStub { 32 public class GlDisplay implements SurfaceHolder.Callback, RenderStub {
33 private volatile long mNativeJniGlDisplay; 33 private long mNativeJniGlDisplay;
Hzj_jie 2016/09/13 19:32:12 Now you can move this field down :)
Yuwei 2016/09/13 20:49:40 Yep. Moved after merging ToT :P
34 private final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChanged = 34 private final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChanged =
35 new Event.Raisable<>(); 35 new Event.Raisable<>();
36 private final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged = 36 private final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged =
37 new Event.Raisable<>(); 37 new Event.Raisable<>();
38 private final Event.Raisable<Void> mOnCanvasRendered = 38 private final Event.Raisable<Void> mOnCanvasRendered =
39 new Event.Raisable<>(); 39 new Event.Raisable<>();
40 private InputFeedbackRadiusMapper mFeedbackRadiusMapper; 40 private InputFeedbackRadiusMapper mFeedbackRadiusMapper;
41 private float mScaleFactor = 0; 41 private float mScaleFactor = 0;
42 42
43 private GlDisplay(long nativeJniGlDisplay) { 43 private GlDisplay(long nativeJniGlDisplay) {
44 mNativeJniGlDisplay = nativeJniGlDisplay; 44 mNativeJniGlDisplay = nativeJniGlDisplay;
45 } 45 }
46 46
47 /** 47 /**
48 * Invalidates this object and disconnects from the native display handler. Called on the 48 * Invalidates this object and disconnects from the native display handler.
49 * display thread by the native code.
50 */ 49 */
51 @CalledByNative 50 @CalledByNative
52 private void invalidate() { 51 private void invalidate() {
53 mNativeJniGlDisplay = 0; 52 mNativeJniGlDisplay = 0;
54 } 53 }
55 54
56 /** 55 /**
57 * Notifies the OpenGL renderer that a surface for OpenGL to draw is created . 56 * Notifies the OpenGL renderer that a surface for OpenGL to draw is created .
58 * @param holder the surface holder that holds the surface. 57 * @param holder the surface holder that holds the surface.
59 */ 58 */
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 private native void nativeOnSurfaceDestroyed(long nativeJniGlDisplayHandler) ; 197 private native void nativeOnSurfaceDestroyed(long nativeJniGlDisplayHandler) ;
199 private native void nativeOnPixelTransformationChanged(long nativeJniGlDispl ayHandler, 198 private native void nativeOnPixelTransformationChanged(long nativeJniGlDispl ayHandler,
200 float[] matrix); 199 float[] matrix);
201 private native void nativeOnCursorPixelPositionChanged(long nativeJniGlDispl ayHandler, 200 private native void nativeOnCursorPixelPositionChanged(long nativeJniGlDispl ayHandler,
202 float x, float y); 201 float x, float y);
203 private native void nativeOnCursorInputFeedback(long nativeJniGlDisplayHandl er, 202 private native void nativeOnCursorInputFeedback(long nativeJniGlDisplayHandl er,
204 float x, float y, float diam eter); 203 float x, float y, float diam eter);
205 private native void nativeOnCursorVisibilityChanged(long nativeJniGlDisplayH andler, 204 private native void nativeOnCursorVisibilityChanged(long nativeJniGlDisplayH andler,
206 boolean visible); 205 boolean visible);
207 } 206 }
OLDNEW
« no previous file with comments | « no previous file | remoting/client/jni/display_updater_factory.h » ('j') | remoting/client/jni/display_updater_factory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698