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

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

Issue 138903025: Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 4b969456 piman@ comments; refactor logic into CompositorVSyncManager 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
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;
46 class Layer; 47 class Layer;
47 class PostedSwapQueue; 48 class PostedSwapQueue;
48 class Reflector; 49 class Reflector;
49 class Texture; 50 class Texture;
50 struct LatencyInfo; 51 struct LatencyInfo;
51 52
52 // This class abstracts the creation of the 3D context for the compositor. It is 53 // This class abstracts the creation of the 3D context for the compositor. It is
53 // a global object. 54 // a global object.
54 class COMPOSITOR_EXPORT ContextFactory { 55 class COMPOSITOR_EXPORT ContextFactory {
55 public: 56 public:
(...skipping 159 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. 216 // Returns the size of the widget that is being drawn to in pixel coordinates.
216 const gfx::Size& size() const { return size_; } 217 const gfx::Size& size() const { return size_; }
217 218
218 // Sets the background color used for areas that aren't covered by 219 // Sets the background color used for areas that aren't covered by
219 // the |root_layer|. 220 // the |root_layer|.
220 void SetBackgroundColor(SkColor color); 221 void SetBackgroundColor(SkColor color);
221 222
222 // Returns the widget for this compositor. 223 // Returns the widget for this compositor.
223 gfx::AcceleratedWidget widget() const { return widget_; } 224 gfx::AcceleratedWidget widget() const { return widget_; }
224 225
226 // Returns the vsync manager for this compositor.
227 scoped_refptr<CompositorVSyncManager> vsync_manager() const;
228
225 // Compositor does not own observers. It is the responsibility of the 229 // Compositor does not own observers. It is the responsibility of the
226 // observer to remove itself when it is done observing. 230 // observer to remove itself when it is done observing.
227 void AddObserver(CompositorObserver* observer); 231 void AddObserver(CompositorObserver* observer);
228 void RemoveObserver(CompositorObserver* observer); 232 void RemoveObserver(CompositorObserver* observer);
229 bool HasObserver(CompositorObserver* observer); 233 bool HasObserver(CompositorObserver* observer);
230 234
231 // Creates a compositor lock. Returns NULL if it is not possible to lock at 235 // Creates a compositor lock. Returns NULL if it is not possible to lock at
232 // this time (i.e. we're waiting to complete a previous unlock). 236 // this time (i.e. we're waiting to complete a previous unlock).
233 scoped_refptr<CompositorLock> GetCompositorLock(); 237 scoped_refptr<CompositorLock> GetCompositorLock();
234 238
235 // Internal functions, called back by command-buffer contexts on swap buffer 239 // Internal functions, called back by command-buffer contexts on swap buffer
236 // events. 240 // events.
237 241
238 // Signals swap has been posted. 242 // Signals swap has been posted.
239 void OnSwapBuffersPosted(); 243 void OnSwapBuffersPosted();
240 244
241 // Signals swap has completed. 245 // Signals swap has completed.
242 void OnSwapBuffersComplete(); 246 void OnSwapBuffersComplete();
243 247
244 // Signals swap has aborted (e.g. lost context). 248 // Signals swap has aborted (e.g. lost context).
245 void OnSwapBuffersAborted(); 249 void OnSwapBuffersAborted();
246 250
247 void OnUpdateVSyncParameters(base::TimeTicks timebase,
248 base::TimeDelta interval);
249
250 // LayerTreeHostClient implementation. 251 // LayerTreeHostClient implementation.
251 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} 252 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
252 virtual void DidBeginMainFrame() OVERRIDE {} 253 virtual void DidBeginMainFrame() OVERRIDE {}
253 virtual void Animate(double frame_begin_time) OVERRIDE {} 254 virtual void Animate(double frame_begin_time) OVERRIDE {}
254 virtual void Layout() OVERRIDE; 255 virtual void Layout() OVERRIDE;
255 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, 256 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
256 float page_scale) OVERRIDE {} 257 float page_scale) OVERRIDE {}
257 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) 258 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
258 OVERRIDE; 259 OVERRIDE;
259 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} 260 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 296
296 // The root of the Layer tree drawn by this compositor. 297 // The root of the Layer tree drawn by this compositor.
297 Layer* root_layer_; 298 Layer* root_layer_;
298 299
299 ObserverList<CompositorObserver> observer_list_; 300 ObserverList<CompositorObserver> observer_list_;
300 301
301 gfx::AcceleratedWidget widget_; 302 gfx::AcceleratedWidget widget_;
302 scoped_refptr<cc::Layer> root_web_layer_; 303 scoped_refptr<cc::Layer> root_web_layer_;
303 scoped_ptr<cc::LayerTreeHost> host_; 304 scoped_ptr<cc::LayerTreeHost> host_;
304 305
306 // The manager of vsync parameters for this compositor.
307 scoped_refptr<CompositorVSyncManager> vsync_manager_;
308
305 // Used to verify that we have at most one draw swap in flight. 309 // Used to verify that we have at most one draw swap in flight.
306 scoped_ptr<PostedSwapQueue> posted_swaps_; 310 scoped_ptr<PostedSwapQueue> posted_swaps_;
307 311
308 // The device scale factor of the monitor that this compositor is compositing 312 // The device scale factor of the monitor that this compositor is compositing
309 // layers on. 313 // layers on.
310 float device_scale_factor_; 314 float device_scale_factor_;
311 315
312 int last_started_frame_; 316 int last_started_frame_;
313 int last_ended_frame_; 317 int last_ended_frame_;
314 318
(...skipping 11 matching lines...) Expand all
326 bool draw_on_compositing_end_; 330 bool draw_on_compositing_end_;
327 331
328 base::WeakPtrFactory<Compositor> schedule_draw_factory_; 332 base::WeakPtrFactory<Compositor> schedule_draw_factory_;
329 333
330 DISALLOW_COPY_AND_ASSIGN(Compositor); 334 DISALLOW_COPY_AND_ASSIGN(Compositor);
331 }; 335 };
332 336
333 } // namespace ui 337 } // namespace ui
334 338
335 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 339 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698