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

Side by Side Diff: remoting/client/jni/jni_gl_display_handler.h

Issue 2338473002: [Remoting Android] JniGlDisplayHandler calls invalidate() on UI thread (Closed)
Patch Set: null-check ui_task_poster_ before using it 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 #ifndef REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_ 5 #ifndef REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_
6 #define REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_ 6 #define REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_
7 7
8 #include <EGL/egl.h> 8 #include <EGL/egl.h>
9 #include <jni.h> 9 #include <jni.h>
10 10
(...skipping 15 matching lines...) Expand all
26 // Handles OpenGL display operations. Draws desktop and cursor on the OpenGL 26 // Handles OpenGL display operations. Draws desktop and cursor on the OpenGL
27 // surface. 27 // surface.
28 // JNI functions should all be called on the UI thread. The display handler 28 // JNI functions should all be called on the UI thread. The display handler
29 // itself should be deleted on the display thread. 29 // itself should be deleted on the display thread.
30 // Please see GlDisplay.java for documentations. 30 // Please see GlDisplay.java for documentations.
31 class JniGlDisplayHandler : public DisplayUpdaterFactory, 31 class JniGlDisplayHandler : public DisplayUpdaterFactory,
32 public protocol::CursorShapeStub, 32 public protocol::CursorShapeStub,
33 public GlRendererDelegate { 33 public GlRendererDelegate {
34 public: 34 public:
35 JniGlDisplayHandler(ChromotingJniRuntime* runtime); 35 JniGlDisplayHandler(ChromotingJniRuntime* runtime);
36 ~JniGlDisplayHandler() override;
37 36
38 // Sets the DesktopViewFactory for the Java client. 37 // Sets the DesktopViewFactory for the Java client.
39 void InitializeClient( 38 void InitializeClient(
40 const base::android::JavaRef<jobject>& java_client); 39 const base::android::JavaRef<jobject>& java_client);
41 40
42 // DisplayUpdaterFactory interface. 41 // DisplayUpdaterFactory interface.
43 std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override; 42 std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override;
44 std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override; 43 std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override;
45 44
45 // Must be called on the UI thread.
46 void Destroy() override;
47
46 static bool RegisterJni(JNIEnv* env); 48 static bool RegisterJni(JNIEnv* env);
47 49
48 void OnSurfaceCreated( 50 void OnSurfaceCreated(
49 JNIEnv* env, 51 JNIEnv* env,
50 const base::android::JavaParamRef<jobject>& caller, 52 const base::android::JavaParamRef<jobject>& caller,
51 const base::android::JavaParamRef<jobject>& surface); 53 const base::android::JavaParamRef<jobject>& surface);
52 54
53 void OnSurfaceChanged(JNIEnv* env, 55 void OnSurfaceChanged(JNIEnv* env,
54 const base::android::JavaParamRef<jobject>& caller, 56 const base::android::JavaParamRef<jobject>& caller,
55 int width, 57 int width,
(...skipping 21 matching lines...) Expand all
77 bool visible); 79 bool visible);
78 80
79 void OnCursorInputFeedback( 81 void OnCursorInputFeedback(
80 JNIEnv* env, 82 JNIEnv* env,
81 const base::android::JavaParamRef<jobject>& caller, 83 const base::android::JavaParamRef<jobject>& caller,
82 float x, 84 float x,
83 float y, 85 float y,
84 float diameter); 86 float diameter);
85 87
86 private: 88 private:
89 ~JniGlDisplayHandler() override;
90
91 // This avoids listing DeleteHelper as friend.
92 void DeleteOnDisplayThread();
93
87 // GlRendererDelegate interface. 94 // GlRendererDelegate interface.
88 bool CanRenderFrame() override; 95 bool CanRenderFrame() override;
89 void OnFrameRendered() override; 96 void OnFrameRendered() override;
90 void OnSizeChanged(int width, int height) override; 97 void OnSizeChanged(int width, int height) override;
91 98
92 // CursorShapeStub interface. 99 // CursorShapeStub interface.
93 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; 100 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
94 101
95 static void NotifyRenderDoneOnUiThread( 102 static void NotifyRenderDoneOnUiThread(
96 base::android::ScopedJavaGlobalRef<jobject> java_display); 103 base::android::ScopedJavaGlobalRef<jobject> java_display);
(...skipping 23 matching lines...) Expand all
120 127
121 // Used on display thread. 128 // Used on display thread.
122 base::WeakPtr<JniGlDisplayHandler> weak_ptr_; 129 base::WeakPtr<JniGlDisplayHandler> weak_ptr_;
123 base::WeakPtrFactory<JniGlDisplayHandler> weak_factory_; 130 base::WeakPtrFactory<JniGlDisplayHandler> weak_factory_;
124 DISALLOW_COPY_AND_ASSIGN(JniGlDisplayHandler); 131 DISALLOW_COPY_AND_ASSIGN(JniGlDisplayHandler);
125 }; 132 };
126 133
127 } // namespace remoting 134 } // namespace remoting
128 135
129 #endif // REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_ 136 #endif // REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698