| 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_GL_RENDERER_H_ | 5 #ifndef REMOTING_CLIENT_GL_RENDERER_H_ |
| 6 #define REMOTING_CLIENT_GL_RENDERER_H_ | 6 #define REMOTING_CLIENT_GL_RENDERER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } // namespace webrtc | 21 } // namespace webrtc |
| 22 | 22 |
| 23 namespace remoting { | 23 namespace remoting { |
| 24 | 24 |
| 25 namespace protocol { | 25 namespace protocol { |
| 26 class CursorShapeInfo; | 26 class CursorShapeInfo; |
| 27 } // namespace protocol | 27 } // namespace protocol |
| 28 | 28 |
| 29 class GlCanvas; | 29 class GlCanvas; |
| 30 class GlRendererDelegate; | 30 class GlRendererDelegate; |
| 31 class GlRendererTest; |
| 31 | 32 |
| 32 // Renders desktop and cursor on the OpenGL surface. Can be created on any | 33 // Renders desktop and cursor on the OpenGL surface. Can be created on any |
| 33 // thread but thereafter must be used and deleted on the same thread (usually | 34 // thread but thereafter must be used and deleted on the same thread (usually |
| 34 // the display thread. Or any Chromium thread with a task runner attached to | 35 // the display thread. Or any Chromium thread with a task runner attached to |
| 35 // it) unless otherwise noted. | 36 // it) unless otherwise noted. |
| 36 // The unit of all length arguments is pixel. | 37 // The unit of all length arguments is pixel. |
| 37 class GlRenderer { | 38 class GlRenderer { |
| 38 public: | 39 public: |
| 39 explicit GlRenderer(); | 40 explicit GlRenderer(); |
| 40 ~GlRenderer(); | 41 ~GlRenderer(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // whenever the view size is changed. | 88 // whenever the view size is changed. |
| 88 void OnSurfaceChanged(int view_width, int view_height); | 89 void OnSurfaceChanged(int view_width, int view_height); |
| 89 | 90 |
| 90 // Called when the surface is destroyed. | 91 // Called when the surface is destroyed. |
| 91 void OnSurfaceDestroyed(); | 92 void OnSurfaceDestroyed(); |
| 92 | 93 |
| 93 // Returns the weak pointer to be used on the display thread. | 94 // Returns the weak pointer to be used on the display thread. |
| 94 base::WeakPtr<GlRenderer> GetWeakPtr(); | 95 base::WeakPtr<GlRenderer> GetWeakPtr(); |
| 95 | 96 |
| 96 private: | 97 private: |
| 98 friend class GlRendererTest; |
| 99 |
| 97 // Post a rendering task to the task runner of current thread. | 100 // Post a rendering task to the task runner of current thread. |
| 98 // Do nothing if render_callback_ is not set yet or an existing rendering task | 101 // Do nothing if render_callback_ is not set yet or an existing rendering task |
| 99 // in the queue will cover changes before this function is called. | 102 // in the queue will cover changes before this function is called. |
| 100 void RequestRender(); | 103 void RequestRender(); |
| 101 | 104 |
| 102 // Draws out everything on current OpenGL buffer and runs closures in | 105 // Draws out everything on current OpenGL buffer and runs closures in |
| 103 // |pending_done_callbacks_|. | 106 // |pending_done_callbacks_|. |
| 104 // Nothing will be drawn nor the done callbacks will be run if |delegate_| is | 107 // Nothing will be drawn nor the done callbacks will be run if |delegate_| is |
| 105 // invalid or !delegate_.CanRenderFrame(). | 108 // invalid or !delegate_.CanRenderFrame(). |
| 106 void OnRender(); | 109 void OnRender(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 125 base::ThreadChecker thread_checker_; | 128 base::ThreadChecker thread_checker_; |
| 126 base::WeakPtr<GlRenderer> weak_ptr_; | 129 base::WeakPtr<GlRenderer> weak_ptr_; |
| 127 base::WeakPtrFactory<GlRenderer> weak_factory_; | 130 base::WeakPtrFactory<GlRenderer> weak_factory_; |
| 128 | 131 |
| 129 DISALLOW_COPY_AND_ASSIGN(GlRenderer); | 132 DISALLOW_COPY_AND_ASSIGN(GlRenderer); |
| 130 }; | 133 }; |
| 131 | 134 |
| 132 } // namespace remoting | 135 } // namespace remoting |
| 133 | 136 |
| 134 #endif // REMOTING_CLIENT_GL_RENDERER_H_ | 137 #endif // REMOTING_CLIENT_GL_RENDERER_H_ |
| OLD | NEW |