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

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
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.DesktopView; 14 import org.chromium.chromoting.DesktopView;
15 import org.chromium.chromoting.Event; 15 import org.chromium.chromoting.Event;
16 import org.chromium.chromoting.InputFeedbackRadiusMapper; 16 import org.chromium.chromoting.InputFeedbackRadiusMapper;
17 import org.chromium.chromoting.RenderStub; 17 import org.chromium.chromoting.RenderStub;
18 import org.chromium.chromoting.SizeChangedEventParameter; 18 import org.chromium.chromoting.SizeChangedEventParameter;
19 19
20 /** 20 /**
21 * This class is a RenderStub implementation that uses the OpenGL renderer in na tive code to render 21 * This class is a RenderStub implementation that uses the OpenGL renderer in na tive code to render
22 * the remote desktop. The lifetime of this class is managed by the native JniGl DisplayHandler. 22 * the remote desktop. The lifetime of this class is managed by the native JniGl DisplayHandler.
23 * 23 *
24 * This class works entirely on the UI thread: 24 * This class works entirely on the UI thread:
25 * Functions should all be called on UI. 25 * All functions, including callbacks from native code are called only on UI th read.
26 * Events will only be triggered on UI.
27 */ 26 */
28 @JNINamespace("remoting") 27 @JNINamespace("remoting")
29 public class GlDisplay implements SurfaceHolder.Callback, RenderStub { 28 public class GlDisplay implements SurfaceHolder.Callback, RenderStub {
30 private final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChanged = 29 private final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChanged =
31 new Event.Raisable<>(); 30 new Event.Raisable<>();
32 private final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged = 31 private final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged =
33 new Event.Raisable<>(); 32 new Event.Raisable<>();
34 private final Event.Raisable<Void> mOnCanvasRendered = new Event.Raisable<>( ); 33 private final Event.Raisable<Void> mOnCanvasRendered = new Event.Raisable<>( );
35 34
36 private volatile long mNativeJniGlDisplay; 35 private long mNativeJniGlDisplay;
37 private InputFeedbackRadiusMapper mFeedbackRadiusMapper; 36 private InputFeedbackRadiusMapper mFeedbackRadiusMapper;
38 private float mScaleFactor = 0; 37 private float mScaleFactor = 0;
39 38
40 private GlDisplay(long nativeJniGlDisplay) { 39 private GlDisplay(long nativeJniGlDisplay) {
41 mNativeJniGlDisplay = nativeJniGlDisplay; 40 mNativeJniGlDisplay = nativeJniGlDisplay;
42 } 41 }
43 42
44 /** 43 /**
45 * Invalidates this object and disconnects from the native display handler. Called on the 44 * Invalidates this object and disconnects from the native display handler.
46 * display thread by the native code.
47 */ 45 */
48 @CalledByNative 46 @CalledByNative
49 private void invalidate() { 47 private void invalidate() {
50 mNativeJniGlDisplay = 0; 48 mNativeJniGlDisplay = 0;
51 } 49 }
52 50
53 /** 51 /**
54 * Notifies the OpenGL renderer that a surface for OpenGL to draw is created . 52 * Notifies the OpenGL renderer that a surface for OpenGL to draw is created .
55 * @param holder the surface holder that holds the surface. 53 * @param holder the surface holder that holds the surface.
56 */ 54 */
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 private native void nativeOnSurfaceDestroyed(long nativeJniGlDisplayHandler) ; 189 private native void nativeOnSurfaceDestroyed(long nativeJniGlDisplayHandler) ;
192 private native void nativeOnPixelTransformationChanged(long nativeJniGlDispl ayHandler, 190 private native void nativeOnPixelTransformationChanged(long nativeJniGlDispl ayHandler,
193 float[] matrix); 191 float[] matrix);
194 private native void nativeOnCursorPixelPositionChanged(long nativeJniGlDispl ayHandler, 192 private native void nativeOnCursorPixelPositionChanged(long nativeJniGlDispl ayHandler,
195 float x, float y); 193 float x, float y);
196 private native void nativeOnCursorInputFeedback(long nativeJniGlDisplayHandl er, 194 private native void nativeOnCursorInputFeedback(long nativeJniGlDisplayHandl er,
197 float x, float y, float diam eter); 195 float x, float y, float diam eter);
198 private native void nativeOnCursorVisibilityChanged(long nativeJniGlDisplayH andler, 196 private native void nativeOnCursorVisibilityChanged(long nativeJniGlDisplayH andler,
199 boolean visible); 197 boolean visible);
200 } 198 }
OLDNEW
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698