Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 // Queues a task running on current call stack. All queued tasks will be | |
|
Lambros
2016/09/16 01:44:12
This first sentence is confusing because of the ph
Yuwei
2016/09/19 23:52:10
Removed.
| |
| 92 // posted to the display thread after the current task is finished. | |
| 93 // Do nothing if |ui_task_poster_| has already been released. | |
| 94 void QueueTaskOnDisplayThread(const base::Closure& task); | |
| 95 | |
| 96 // This avoids listing DeleteHelper as friend. | |
|
Lambros
2016/09/16 01:44:12
I would rephrase this comment without 'DeleteHelpe
Yuwei
2016/09/19 23:52:10
Obsolete.
| |
| 97 void DeleteOnDisplayThread(); | |
| 98 | |
| 87 // GlRendererDelegate interface. | 99 // GlRendererDelegate interface. |
| 88 bool CanRenderFrame() override; | 100 bool CanRenderFrame() override; |
| 89 void OnFrameRendered() override; | 101 void OnFrameRendered() override; |
| 90 void OnSizeChanged(int width, int height) override; | 102 void OnSizeChanged(int width, int height) override; |
| 91 | 103 |
| 92 // CursorShapeStub interface. | 104 // CursorShapeStub interface. |
| 93 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; | 105 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; |
| 94 | 106 |
| 95 static void NotifyRenderDoneOnUiThread( | 107 static void NotifyRenderDoneOnUiThread( |
| 96 base::android::ScopedJavaGlobalRef<jobject> java_display); | 108 base::android::ScopedJavaGlobalRef<jobject> java_display); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 120 | 132 |
| 121 // Used on display thread. | 133 // Used on display thread. |
| 122 base::WeakPtr<JniGlDisplayHandler> weak_ptr_; | 134 base::WeakPtr<JniGlDisplayHandler> weak_ptr_; |
| 123 base::WeakPtrFactory<JniGlDisplayHandler> weak_factory_; | 135 base::WeakPtrFactory<JniGlDisplayHandler> weak_factory_; |
| 124 DISALLOW_COPY_AND_ASSIGN(JniGlDisplayHandler); | 136 DISALLOW_COPY_AND_ASSIGN(JniGlDisplayHandler); |
| 125 }; | 137 }; |
| 126 | 138 |
| 127 } // namespace remoting | 139 } // namespace remoting |
| 128 | 140 |
| 129 #endif // REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_ | 141 #endif // REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_ |
| OLD | NEW |