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_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 #include <vector> | |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 14 #include "remoting/client/gl_cursor.h" | 15 #include "remoting/client/gl_cursor.h" |
| 15 #include "remoting/client/gl_cursor_feedback.h" | 16 #include "remoting/client/gl_cursor_feedback.h" |
| 16 #include "remoting/client/gl_desktop.h" | 17 #include "remoting/client/gl_desktop.h" |
| 17 #include "remoting/proto/control.pb.h" | 18 #include "remoting/proto/control.pb.h" |
| 18 | 19 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 // surface is recreated. | 85 // surface is recreated. |
| 85 void OnSurfaceCreated(int gl_version); | 86 void OnSurfaceCreated(int gl_version); |
| 86 | 87 |
| 87 // Sets the size of the view. Called right after OnSurfaceCreated() or | 88 // Sets the size of the view. Called right after OnSurfaceCreated() or |
| 88 // whenever the view size is changed. | 89 // whenever the view size is changed. |
| 89 void OnSurfaceChanged(int view_width, int view_height); | 90 void OnSurfaceChanged(int view_width, int view_height); |
| 90 | 91 |
| 91 // Called when the surface is destroyed. | 92 // Called when the surface is destroyed. |
| 92 void OnSurfaceDestroyed(); | 93 void OnSurfaceDestroyed(); |
| 93 | 94 |
| 95 void AddDrawable(base::WeakPtr<GlDrawable> drawable); | |
| 96 | |
| 94 // Returns the weak pointer to be used on the display thread. | 97 // Returns the weak pointer to be used on the display thread. |
| 95 base::WeakPtr<GlRenderer> GetWeakPtr(); | 98 base::WeakPtr<GlRenderer> GetWeakPtr(); |
| 96 | 99 |
| 100 static GlRenderer* CreateGlRendererWithDesktop(); | |
|
joedow
2016/12/22 00:29:03
Add comment block please. Who owns the renderer*
joedow
2016/12/22 19:18:10
Actually this would also be more clear if it retur
nicholss
2017/01/09 18:50:24
Done.
| |
| 101 | |
| 97 private: | 102 private: |
| 98 friend class GlRendererTest; | 103 friend class GlRendererTest; |
| 99 | 104 |
| 100 // Post a rendering task to the task runner of current thread. | 105 // Post a rendering task to the task runner of current thread. |
| 101 // Do nothing if render_callback_ is not set yet or an existing rendering task | 106 // Do nothing if render_callback_ is not set yet or an existing rendering task |
| 102 // in the queue will cover changes before this function is called. | 107 // in the queue will cover changes before this function is called. |
| 103 void RequestRender(); | 108 void RequestRender(); |
| 104 | 109 |
| 105 // Draws out everything on current OpenGL buffer and runs closures in | 110 // Draws out everything on current OpenGL buffer and runs closures in |
| 106 // |pending_done_callbacks_|. | 111 // |pending_done_callbacks_|. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 118 | 123 |
| 119 int canvas_width_ = 0; | 124 int canvas_width_ = 0; |
| 120 int canvas_height_ = 0; | 125 int canvas_height_ = 0; |
| 121 | 126 |
| 122 std::unique_ptr<GlCanvas> canvas_; | 127 std::unique_ptr<GlCanvas> canvas_; |
| 123 | 128 |
| 124 GlCursor cursor_; | 129 GlCursor cursor_; |
| 125 GlCursorFeedback cursor_feedback_; | 130 GlCursorFeedback cursor_feedback_; |
| 126 GlDesktop desktop_; | 131 GlDesktop desktop_; |
| 127 | 132 |
| 133 std::vector<base::WeakPtr<GlDrawable>> drawables_; | |
| 134 | |
| 128 base::ThreadChecker thread_checker_; | 135 base::ThreadChecker thread_checker_; |
| 129 base::WeakPtr<GlRenderer> weak_ptr_; | |
| 130 base::WeakPtrFactory<GlRenderer> weak_factory_; | 136 base::WeakPtrFactory<GlRenderer> weak_factory_; |
| 131 | 137 |
| 132 DISALLOW_COPY_AND_ASSIGN(GlRenderer); | 138 DISALLOW_COPY_AND_ASSIGN(GlRenderer); |
| 133 }; | 139 }; |
| 134 | 140 |
| 135 } // namespace remoting | 141 } // namespace remoting |
| 136 | 142 |
| 137 #endif // REMOTING_CLIENT_GL_RENDERER_H_ | 143 #endif // REMOTING_CLIENT_GL_RENDERER_H_ |
| OLD | NEW |