Index: ui/compositor/compositor.h |
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h |
index b2d27797de7fc1af7938ba330d02eb39f891cbc5..0f26bd73b72c86cb9285804b1a870d634f0d4e6f 100644 |
--- a/ui/compositor/compositor.h |
+++ b/ui/compositor/compositor.h |
@@ -13,9 +13,11 @@ |
#include "base/observer_list.h" |
#include "base/single_thread_task_runner.h" |
#include "base/time/time.h" |
+#include "cc/output/begin_frame_args.h" |
#include "cc/trees/layer_tree_host_client.h" |
#include "cc/trees/layer_tree_host_single_thread_client.h" |
#include "third_party/skia/include/core/SkColor.h" |
+#include "ui/base/compositor/compositor_begin_frame_observer.h" |
#include "ui/compositor/compositor_animation_observer.h" |
#include "ui/compositor/compositor_export.h" |
#include "ui/compositor/compositor_observer.h" |
@@ -49,7 +51,6 @@ struct Mailbox; |
namespace ui { |
class Compositor; |
-class CompositorVSyncManager; |
class Layer; |
class Reflector; |
class Texture; |
@@ -184,8 +185,16 @@ class COMPOSITOR_EXPORT Compositor |
// Returns the widget for this compositor. |
gfx::AcceleratedWidget widget() const { return widget_; } |
- // Returns the vsync manager for this compositor. |
- scoped_refptr<CompositorVSyncManager> vsync_manager() const; |
+ // The "authoritative" vsync interval, if provided, will override interval |
+ // reported from 3D context. This is typically the value reported by a more |
+ // reliable source, e.g, the platform display configuration. |
+ // In the particular case of ChromeOS -- this is the value queried through |
+ // XRandR, which is more reliable than the value queried through the 3D |
+ // context. |
+ void SetAuthoritativeVSyncInterval(base::TimeDelta interval) const; |
+ |
+ // Request BeginFrame scheduling to OutputSurface. |
+ void StartBeginFrame(const cc::BeginFrameArgs& args) const; |
// Compositor does not own observers. It is the responsibility of the |
// observer to remove itself when it is done observing. |
@@ -197,6 +206,11 @@ class COMPOSITOR_EXPORT Compositor |
void RemoveAnimationObserver(CompositorAnimationObserver* observer); |
bool HasAnimationObserver(CompositorAnimationObserver* observer); |
+ void AddBeginFrameObserver( |
+ CompositorBeginFrameObserver* observer, |
+ const cc::BeginFrameArgs& last_begin_frame_args_sent_to_observer); |
+ void RemoveBeginFrameObserver(CompositorBeginFrameObserver* observer); |
+ |
// Creates a compositor lock. Returns NULL if it is not possible to lock at |
// this time (i.e. we're waiting to complete a previous unlock). |
scoped_refptr<CompositorLock> GetCompositorLock(); |
@@ -222,11 +236,14 @@ class COMPOSITOR_EXPORT Compositor |
float page_scale) OVERRIDE {} |
virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) |
OVERRIDE; |
- virtual void DidInitializeOutputSurface() OVERRIDE {} |
+ virtual void DidInitializeOutputSurface() OVERRIDE; |
+ virtual void DidLoseOutputSurface() OVERRIDE; |
virtual void WillCommit() OVERRIDE {} |
virtual void DidCommit() OVERRIDE; |
virtual void DidCommitAndDrawFrame() OVERRIDE; |
virtual void DidCompleteSwapBuffers() OVERRIDE; |
+ virtual void SendBeginFrameToChildren( |
+ const cc::BeginFrameArgs& args) OVERRIDE; |
// cc::LayerTreeHostSingleThreadClient implementation. |
virtual void DidPostSwapBuffers() OVERRIDE; |
@@ -251,6 +268,9 @@ class COMPOSITOR_EXPORT Compositor |
// Called to release any pending CompositorLock |
void CancelCompositorLock(); |
+ // Request scheduling of next BeginFrame to LayerTreeHost. |
+ void SetChildrenNeedBeginFrames(bool need_begin_frame); |
+ |
gfx::Size size_; |
ui::ContextFactory* context_factory_; |
@@ -260,6 +280,7 @@ class COMPOSITOR_EXPORT Compositor |
ObserverList<CompositorObserver> observer_list_; |
ObserverList<CompositorAnimationObserver> animation_observer_list_; |
+ ObserverList<CompositorBeginFrameObserver> begin_frame_observer_list_; |
gfx::AcceleratedWidget widget_; |
scoped_refptr<cc::Layer> root_web_layer_; |
@@ -267,9 +288,6 @@ class COMPOSITOR_EXPORT Compositor |
scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_; |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
- // The manager of vsync parameters for this compositor. |
- scoped_refptr<CompositorVSyncManager> vsync_manager_; |
- |
// The device scale factor of the monitor that this compositor is compositing |
// layers on. |
float device_scale_factor_; |
@@ -283,6 +301,16 @@ class COMPOSITOR_EXPORT Compositor |
LayerAnimatorCollection layer_animator_collection_; |
+ // Used to send to any new BeginFrame observers immediately. |
+ cc::BeginFrameArgs last_begin_frame_args_; |
+ |
+ // Only used to post OutputSurface::BeginFrame to |task_runner_|. because |
+ // requesting a BeginFrame from compositor is only used on single threaded |
+ // mode. |
+ base::WeakPtr<cc::OutputSurface> output_surface_weak_ptr_; |
+ |
+ bool output_surface_lost_; |
+ |
DISALLOW_COPY_AND_ASSIGN(Compositor); |
}; |