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

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

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP in mac and android Created 6 years, 3 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 12 matching lines...) Expand all
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/size.h" 24 #include "ui/gfx/size.h"
25 #include "ui/gfx/vector2d.h" 25 #include "ui/gfx/vector2d.h"
26 26
27 namespace base { 27 namespace base {
28 class MessageLoopProxy; 28 class MessageLoopProxy;
29 class RunLoop; 29 class RunLoop;
30 } 30 }
31 31
32 namespace cc { 32 namespace cc {
33 class BeginFrameManager;
33 class ContextProvider; 34 class ContextProvider;
34 class Layer; 35 class Layer;
35 class LayerTreeDebugState; 36 class LayerTreeDebugState;
36 class LayerTreeHost; 37 class LayerTreeHost;
37 class SharedBitmapManager; 38 class SharedBitmapManager;
38 } 39 }
39 40
40 namespace gfx { 41 namespace gfx {
41 class Rect; 42 class Rect;
42 class Size; 43 class Size;
43 } 44 }
44 45
45 namespace gpu { 46 namespace gpu {
46 struct Mailbox; 47 struct Mailbox;
47 } 48 }
48 49
49 namespace ui { 50 namespace ui {
50 51
51 class Compositor; 52 class Compositor;
52 class CompositorVSyncManager;
53 class Layer; 53 class Layer;
54 class Reflector; 54 class Reflector;
55 class Texture; 55 class Texture;
56 struct LatencyInfo; 56 struct LatencyInfo;
57 57
58 // This class abstracts the creation of the 3D context for the compositor. It is 58 // This class abstracts the creation of the 3D context for the compositor. It is
59 // a global object. 59 // a global object.
60 class COMPOSITOR_EXPORT ContextFactory { 60 class COMPOSITOR_EXPORT ContextFactory {
61 public: 61 public:
62 virtual ~ContextFactory() {} 62 virtual ~ContextFactory() {}
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Returns the size of the widget that is being drawn to in pixel coordinates. 177 // Returns the size of the widget that is being drawn to in pixel coordinates.
178 const gfx::Size& size() const { return size_; } 178 const gfx::Size& size() const { return size_; }
179 179
180 // Sets the background color used for areas that aren't covered by 180 // Sets the background color used for areas that aren't covered by
181 // the |root_layer|. 181 // the |root_layer|.
182 void SetBackgroundColor(SkColor color); 182 void SetBackgroundColor(SkColor color);
183 183
184 // Returns the widget for this compositor. 184 // Returns the widget for this compositor.
185 gfx::AcceleratedWidget widget() const { return widget_; } 185 gfx::AcceleratedWidget widget() const { return widget_; }
186 186
187 // Returns the vsync manager for this compositor. 187 // See cc::BeginFrameManager::Delegate comment.
188 scoped_refptr<CompositorVSyncManager> vsync_manager() const; 188 void SetAuthoritativeVSyncInterval(base::TimeDelta interval) const;
189
190 cc::BeginFrameManager* begin_frame_manager() const {
brianderson 2014/08/28 02:48:07 Instead of exposing the BeginFrameManager to every
simonhong 2014/09/03 21:02:23 BeginFrameManager is removed. Instead, {Add|Remove
191 return begin_frame_manager_.get();
192 }
189 193
190 // Compositor does not own observers. It is the responsibility of the 194 // Compositor does not own observers. It is the responsibility of the
191 // observer to remove itself when it is done observing. 195 // observer to remove itself when it is done observing.
192 void AddObserver(CompositorObserver* observer); 196 void AddObserver(CompositorObserver* observer);
193 void RemoveObserver(CompositorObserver* observer); 197 void RemoveObserver(CompositorObserver* observer);
194 bool HasObserver(CompositorObserver* observer); 198 bool HasObserver(CompositorObserver* observer);
195 199
196 void AddAnimationObserver(CompositorAnimationObserver* observer); 200 void AddAnimationObserver(CompositorAnimationObserver* observer);
197 void RemoveAnimationObserver(CompositorAnimationObserver* observer); 201 void RemoveAnimationObserver(CompositorAnimationObserver* observer);
198 bool HasAnimationObserver(CompositorAnimationObserver* observer); 202 bool HasAnimationObserver(CompositorAnimationObserver* observer);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 264
261 ObserverList<CompositorObserver> observer_list_; 265 ObserverList<CompositorObserver> observer_list_;
262 ObserverList<CompositorAnimationObserver> animation_observer_list_; 266 ObserverList<CompositorAnimationObserver> animation_observer_list_;
263 267
264 gfx::AcceleratedWidget widget_; 268 gfx::AcceleratedWidget widget_;
265 scoped_refptr<cc::Layer> root_web_layer_; 269 scoped_refptr<cc::Layer> root_web_layer_;
266 scoped_ptr<cc::LayerTreeHost> host_; 270 scoped_ptr<cc::LayerTreeHost> host_;
267 scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_; 271 scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_;
268 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 272 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
269 273
270 // The manager of vsync parameters for this compositor. 274 // The manager of BeginFrame routing.
271 scoped_refptr<CompositorVSyncManager> vsync_manager_; 275 scoped_ptr<cc::BeginFrameManager> begin_frame_manager_;
brianderson 2014/08/28 02:48:07 Would it make sense for the LTH or Proxy to own th
simonhong 2014/08/29 00:03:01 My plan was making BeginFrameManager as a member v
272 276
273 // The device scale factor of the monitor that this compositor is compositing 277 // The device scale factor of the monitor that this compositor is compositing
274 // layers on. 278 // layers on.
275 float device_scale_factor_; 279 float device_scale_factor_;
276 280
277 int last_started_frame_; 281 int last_started_frame_;
278 int last_ended_frame_; 282 int last_ended_frame_;
279 283
280 bool disable_schedule_composite_; 284 bool disable_schedule_composite_;
281 285
282 CompositorLock* compositor_lock_; 286 CompositorLock* compositor_lock_;
283 287
284 LayerAnimatorCollection layer_animator_collection_; 288 LayerAnimatorCollection layer_animator_collection_;
285 289
286 DISALLOW_COPY_AND_ASSIGN(Compositor); 290 DISALLOW_COPY_AND_ASSIGN(Compositor);
287 }; 291 };
288 292
289 } // namespace ui 293 } // namespace ui
290 294
291 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 295 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698