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(GlDrawable* drawable); | |
|
Yuwei
2016/12/19 23:26:09
Could we just make the class own the drawable? Hol
Yuwei
2016/12/19 23:54:19
I meant something like ShouldDrawDemoScreen(boolea
| |
| 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 |
| 97 private: | 100 private: |
| 98 friend class GlRendererTest; | 101 friend class GlRendererTest; |
| 99 | 102 |
| 100 // Post a rendering task to the task runner of current thread. | 103 // 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 | 104 // 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. | 105 // in the queue will cover changes before this function is called. |
| 103 void RequestRender(); | 106 void RequestRender(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 118 | 121 |
| 119 int canvas_width_ = 0; | 122 int canvas_width_ = 0; |
| 120 int canvas_height_ = 0; | 123 int canvas_height_ = 0; |
| 121 | 124 |
| 122 std::unique_ptr<GlCanvas> canvas_; | 125 std::unique_ptr<GlCanvas> canvas_; |
| 123 | 126 |
| 124 GlCursor cursor_; | 127 GlCursor cursor_; |
| 125 GlCursorFeedback cursor_feedback_; | 128 GlCursorFeedback cursor_feedback_; |
| 126 GlDesktop desktop_; | 129 GlDesktop desktop_; |
| 127 | 130 |
| 131 std::vector<GlDrawable*> drawables; | |
|
joedow
2016/12/19 23:56:26
Does order of the drawing matter? Maybe add a com
joedow
2016/12/19 23:56:26
Is a raw* the right thing? Can ownership be trans
joedow
2016/12/19 23:56:26
s/drawables/drawables_
| |
| 132 | |
| 128 base::ThreadChecker thread_checker_; | 133 base::ThreadChecker thread_checker_; |
| 129 base::WeakPtr<GlRenderer> weak_ptr_; | 134 base::WeakPtr<GlRenderer> weak_ptr_; |
| 130 base::WeakPtrFactory<GlRenderer> weak_factory_; | 135 base::WeakPtrFactory<GlRenderer> weak_factory_; |
| 131 | 136 |
| 132 DISALLOW_COPY_AND_ASSIGN(GlRenderer); | 137 DISALLOW_COPY_AND_ASSIGN(GlRenderer); |
| 133 }; | 138 }; |
| 134 | 139 |
| 135 } // namespace remoting | 140 } // namespace remoting |
| 136 | 141 |
| 137 #endif // REMOTING_CLIENT_GL_RENDERER_H_ | 142 #endif // REMOTING_CLIENT_GL_RENDERER_H_ |
| OLD | NEW |