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

Side by Side Diff: remoting/client/gl_renderer.h

Issue 2196493002: [Chromoting] Unit Tests for GlRenderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make RequestRender private and declare the test as friend Created 4 years, 4 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_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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Do nothing if render_callback_ is not set yet or an existing rendering task 99 // 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. 100 // in the queue will cover changes before this function is called.
100 void RequestRender(); 101 void RequestRender();
101 102
102 // Draws out everything on current OpenGL buffer and runs closures in 103 // Draws out everything on current OpenGL buffer and runs closures in
103 // |pending_done_callbacks_|. 104 // |pending_done_callbacks_|.
104 // Nothing will be drawn nor the done callbacks will be run if |delegate_| is 105 // Nothing will be drawn nor the done callbacks will be run if |delegate_| is
105 // invalid or !delegate_.CanRenderFrame(). 106 // invalid or !delegate_.CanRenderFrame().
106 void OnRender(); 107 void OnRender();
107 108
109 friend class GlRendererTest;
110
108 base::WeakPtr<GlRendererDelegate> delegate_; 111 base::WeakPtr<GlRendererDelegate> delegate_;
109 112
110 // Done callbacks from OnFrameReceived. Will all be called once rendering 113 // Done callbacks from OnFrameReceived. Will all be called once rendering
111 // takes place. 114 // takes place.
112 std::queue<base::Closure> pending_done_callbacks_; 115 std::queue<base::Closure> pending_done_callbacks_;
113 116
114 bool render_scheduled_ = false; 117 bool render_scheduled_ = false;
115 118
116 int view_width_ = 0; 119 int view_width_ = 0;
117 int view_height_ = 0; 120 int view_height_ = 0;
118 int canvas_width_ = 0; 121 int canvas_width_ = 0;
119 int canvas_height_ = 0; 122 int canvas_height_ = 0;
120 123
121 std::unique_ptr<GlCanvas> canvas_; 124 std::unique_ptr<GlCanvas> canvas_;
122 125
123 GlCursor cursor_; 126 GlCursor cursor_;
124 GlCursorFeedback cursor_feedback_; 127 GlCursorFeedback cursor_feedback_;
125 GlDesktop desktop_; 128 GlDesktop desktop_;
126 129
127 base::ThreadChecker thread_checker_; 130 base::ThreadChecker thread_checker_;
128 base::WeakPtr<GlRenderer> weak_ptr_; 131 base::WeakPtr<GlRenderer> weak_ptr_;
129 base::WeakPtrFactory<GlRenderer> weak_factory_; 132 base::WeakPtrFactory<GlRenderer> weak_factory_;
130 133
131 DISALLOW_COPY_AND_ASSIGN(GlRenderer); 134 DISALLOW_COPY_AND_ASSIGN(GlRenderer);
132 }; 135 };
133 136
134 } // namespace remoting 137 } // namespace remoting
135 138
136 #endif // REMOTING_CLIENT_GL_RENDERER_H_ 139 #endif // REMOTING_CLIENT_GL_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698