| Index: ui/compositor/compositor.h
|
| diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
|
| index 47d4cd0d7e30866f980299191cd5994d386673b9..561fee610e6005b0e1a614009e539152d2e5b970 100644
|
| --- a/ui/compositor/compositor.h
|
| +++ b/ui/compositor/compositor.h
|
| @@ -13,6 +13,7 @@
|
| #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/surfaces/surface_sequence.h"
|
| #include "cc/trees/layer_tree_host_client.h"
|
| #include "cc/trees/layer_tree_host_single_thread_client.h"
|
| @@ -131,6 +132,14 @@ class COMPOSITOR_EXPORT CompositorLock
|
| DISALLOW_COPY_AND_ASSIGN(CompositorLock);
|
| };
|
|
|
| +// This class observes BeginFrame notification from LayerTreeHost.
|
| +class COMPOSITOR_EXPORT CompositorBeginFrameObserver {
|
| + public:
|
| + virtual ~CompositorBeginFrameObserver() {}
|
| +
|
| + virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) = 0;
|
| +};
|
| +
|
| // Compositor object to take care of GPU painting.
|
| // A Browser compositor object is responsible for generating the final
|
| // displayable form of pixels comprising a single widget's contents. It draws an
|
| @@ -226,6 +235,11 @@ class COMPOSITOR_EXPORT Compositor
|
| void RemoveAnimationObserver(CompositorAnimationObserver* observer);
|
| bool HasAnimationObserver(const CompositorAnimationObserver* observer) const;
|
|
|
| + 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();
|
| @@ -264,6 +278,7 @@ class COMPOSITOR_EXPORT Compositor
|
| void DidCommitAndDrawFrame() override;
|
| void DidCompleteSwapBuffers() override;
|
| void DidCompletePageScaleAnimation() override {}
|
| + void SendBeginFramesToChildren(const cc::BeginFrameArgs& args) override;
|
|
|
| // cc::LayerTreeHostSingleThreadClient implementation.
|
| void DidPostSwapBuffers() override;
|
| @@ -283,6 +298,11 @@ class COMPOSITOR_EXPORT Compositor
|
| return surface_id_allocator_.get();
|
| }
|
|
|
| + // Exposed for testing
|
| + cc::BeginFrameArgs MissedBeginFrameArgsForTesting() {
|
| + return missed_begin_frame_args_;
|
| + }
|
| +
|
| private:
|
| friend class base::RefCounted<Compositor>;
|
| friend class CompositorLock;
|
| @@ -302,6 +322,7 @@ class COMPOSITOR_EXPORT Compositor
|
|
|
| ObserverList<CompositorObserver, true> observer_list_;
|
| ObserverList<CompositorAnimationObserver> animation_observer_list_;
|
| + ObserverList<CompositorBeginFrameObserver> begin_frame_observer_list_;
|
|
|
| gfx::AcceleratedWidget widget_;
|
| scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
|
| @@ -325,6 +346,9 @@ class COMPOSITOR_EXPORT Compositor
|
|
|
| LayerAnimatorCollection layer_animator_collection_;
|
|
|
| + // Used to send to any new CompositorBeginFrameObserver immediately.
|
| + cc::BeginFrameArgs missed_begin_frame_args_;
|
| +
|
| base::WeakPtrFactory<Compositor> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Compositor);
|
|
|