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

Side by Side Diff: ui/compositor/compositor.h

Issue 161413002: Revert of Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_COMPOSITOR_COMPOSITOR_H_ 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_
6 #define UI_COMPOSITOR_COMPOSITOR_H_ 6 #define UI_COMPOSITOR_COMPOSITOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 namespace gfx { 38 namespace gfx {
39 class Rect; 39 class Rect;
40 class Size; 40 class Size;
41 } 41 }
42 42
43 namespace ui { 43 namespace ui {
44 44
45 class Compositor; 45 class Compositor;
46 class CompositorVSyncManager;
47 class Layer; 46 class Layer;
48 class PostedSwapQueue; 47 class PostedSwapQueue;
49 class Reflector; 48 class Reflector;
50 class Texture; 49 class Texture;
51 struct LatencyInfo; 50 struct LatencyInfo;
52 51
53 // This class abstracts the creation of the 3D context for the compositor. It is 52 // This class abstracts the creation of the 3D context for the compositor. It is
54 // a global object. 53 // a global object.
55 class COMPOSITOR_EXPORT ContextFactory { 54 class COMPOSITOR_EXPORT ContextFactory {
56 public: 55 public:
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DISALLOW_COPY_AND_ASSIGN(CompositorLock); 156 DISALLOW_COPY_AND_ASSIGN(CompositorLock);
158 }; 157 };
159 158
160 // Compositor object to take care of GPU painting. 159 // Compositor object to take care of GPU painting.
161 // A Browser compositor object is responsible for generating the final 160 // A Browser compositor object is responsible for generating the final
162 // displayable form of pixels comprising a single widget's contents. It draws an 161 // displayable form of pixels comprising a single widget's contents. It draws an
163 // appropriately transformed texture for each transformed view in the widget's 162 // appropriately transformed texture for each transformed view in the widget's
164 // view hierarchy. 163 // view hierarchy.
165 class COMPOSITOR_EXPORT Compositor 164 class COMPOSITOR_EXPORT Compositor
166 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), 165 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient),
167 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { 166 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient),
167 public base::SupportsWeakPtr<Compositor> {
168 public: 168 public:
169 explicit Compositor(gfx::AcceleratedWidget widget); 169 explicit Compositor(gfx::AcceleratedWidget widget);
170 virtual ~Compositor(); 170 virtual ~Compositor();
171 171
172 static void Initialize(); 172 static void Initialize();
173 static bool WasInitializedWithThread(); 173 static bool WasInitializedWithThread();
174 static scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop(); 174 static scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop();
175 static void Terminate(); 175 static void Terminate();
176 176
177 // Schedules a redraw of the layer tree associated with this compositor. 177 // Schedules a redraw of the layer tree associated with this compositor.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Returns the size of the widget that is being drawn to in pixel coordinates. 215 // Returns the size of the widget that is being drawn to in pixel coordinates.
216 const gfx::Size& size() const { return size_; } 216 const gfx::Size& size() const { return size_; }
217 217
218 // Sets the background color used for areas that aren't covered by 218 // Sets the background color used for areas that aren't covered by
219 // the |root_layer|. 219 // the |root_layer|.
220 void SetBackgroundColor(SkColor color); 220 void SetBackgroundColor(SkColor color);
221 221
222 // Returns the widget for this compositor. 222 // Returns the widget for this compositor.
223 gfx::AcceleratedWidget widget() const { return widget_; } 223 gfx::AcceleratedWidget widget() const { return widget_; }
224 224
225 // Returns the vsync manager for this compositor.
226 scoped_refptr<CompositorVSyncManager> vsync_manager() const;
227
228 // Compositor does not own observers. It is the responsibility of the 225 // Compositor does not own observers. It is the responsibility of the
229 // observer to remove itself when it is done observing. 226 // observer to remove itself when it is done observing.
230 void AddObserver(CompositorObserver* observer); 227 void AddObserver(CompositorObserver* observer);
231 void RemoveObserver(CompositorObserver* observer); 228 void RemoveObserver(CompositorObserver* observer);
232 bool HasObserver(CompositorObserver* observer); 229 bool HasObserver(CompositorObserver* observer);
233 230
234 // Creates a compositor lock. Returns NULL if it is not possible to lock at 231 // Creates a compositor lock. Returns NULL if it is not possible to lock at
235 // this time (i.e. we're waiting to complete a previous unlock). 232 // this time (i.e. we're waiting to complete a previous unlock).
236 scoped_refptr<CompositorLock> GetCompositorLock(); 233 scoped_refptr<CompositorLock> GetCompositorLock();
237 234
238 // Internal functions, called back by command-buffer contexts on swap buffer 235 // Internal functions, called back by command-buffer contexts on swap buffer
239 // events. 236 // events.
240 237
241 // Signals swap has been posted. 238 // Signals swap has been posted.
242 void OnSwapBuffersPosted(); 239 void OnSwapBuffersPosted();
243 240
244 // Signals swap has completed. 241 // Signals swap has completed.
245 void OnSwapBuffersComplete(); 242 void OnSwapBuffersComplete();
246 243
247 // Signals swap has aborted (e.g. lost context). 244 // Signals swap has aborted (e.g. lost context).
248 void OnSwapBuffersAborted(); 245 void OnSwapBuffersAborted();
249 246
247 void OnUpdateVSyncParameters(base::TimeTicks timebase,
248 base::TimeDelta interval);
249
250 // LayerTreeHostClient implementation. 250 // LayerTreeHostClient implementation.
251 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} 251 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
252 virtual void DidBeginMainFrame() OVERRIDE {} 252 virtual void DidBeginMainFrame() OVERRIDE {}
253 virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {} 253 virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
254 virtual void Layout() OVERRIDE; 254 virtual void Layout() OVERRIDE;
255 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, 255 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
256 float page_scale) OVERRIDE {} 256 float page_scale) OVERRIDE {}
257 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) 257 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
258 OVERRIDE; 258 OVERRIDE;
259 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} 259 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 // The root of the Layer tree drawn by this compositor. 296 // The root of the Layer tree drawn by this compositor.
297 Layer* root_layer_; 297 Layer* root_layer_;
298 298
299 ObserverList<CompositorObserver> observer_list_; 299 ObserverList<CompositorObserver> observer_list_;
300 300
301 gfx::AcceleratedWidget widget_; 301 gfx::AcceleratedWidget widget_;
302 scoped_refptr<cc::Layer> root_web_layer_; 302 scoped_refptr<cc::Layer> root_web_layer_;
303 scoped_ptr<cc::LayerTreeHost> host_; 303 scoped_ptr<cc::LayerTreeHost> host_;
304 304
305 // The manager of vsync parameters for this compositor.
306 scoped_refptr<CompositorVSyncManager> vsync_manager_;
307
308 // Used to verify that we have at most one draw swap in flight. 305 // Used to verify that we have at most one draw swap in flight.
309 scoped_ptr<PostedSwapQueue> posted_swaps_; 306 scoped_ptr<PostedSwapQueue> posted_swaps_;
310 307
311 // The device scale factor of the monitor that this compositor is compositing 308 // The device scale factor of the monitor that this compositor is compositing
312 // layers on. 309 // layers on.
313 float device_scale_factor_; 310 float device_scale_factor_;
314 311
315 int last_started_frame_; 312 int last_started_frame_;
316 int last_ended_frame_; 313 int last_ended_frame_;
317 314
(...skipping 11 matching lines...) Expand all
329 bool draw_on_compositing_end_; 326 bool draw_on_compositing_end_;
330 327
331 base::WeakPtrFactory<Compositor> schedule_draw_factory_; 328 base::WeakPtrFactory<Compositor> schedule_draw_factory_;
332 329
333 DISALLOW_COPY_AND_ASSIGN(Compositor); 330 DISALLOW_COPY_AND_ASSIGN(Compositor);
334 }; 331 };
335 332
336 } // namespace ui 333 } // namespace ui
337 334
338 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 335 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698