Index: ui/compositor/compositor.h |
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h |
index 5f4ed2ee4d2c564eef8fb6c1a79d2a75fa188cc3..d093b971d26edec682b669c63bfe012a2a7da792 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" |
@@ -51,7 +53,6 @@ struct Mailbox; |
namespace ui { |
class Compositor; |
-class CompositorVSyncManager; |
class Layer; |
class Reflector; |
class Texture; |
@@ -192,8 +193,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; |
// Returns the main thread task runner this compositor uses. Users of the |
// compositor generally shouldn't use this. |
@@ -211,6 +220,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(); |
@@ -236,11 +250,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 ScheduleComposite() OVERRIDE; |
@@ -273,6 +290,9 @@ class COMPOSITOR_EXPORT Compositor |
// Notifies the compositor that compositing is complete. |
void NotifyEnd(); |
+ // Request scheduling of next BeginFrame to LayerTreeHost. |
+ void SetChildrenNeedBeginFrames(bool need_begin_frame); |
+ |
gfx::Size size_; |
ui::ContextFactory* context_factory_; |
@@ -282,6 +302,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_; |
@@ -289,9 +310,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_; |
@@ -316,6 +334,16 @@ class COMPOSITOR_EXPORT Compositor |
base::WeakPtrFactory<Compositor> schedule_draw_factory_; |
+ // 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); |
}; |