Chromium Code Reviews| Index: cc/trees/single_thread_proxy.h |
| diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h |
| index 616f5767b1e14c66b2a3fe669d92e31b1678c1b4..02e1f61a36b09e0f52081dd34003b35f033ffd95 100644 |
| --- a/cc/trees/single_thread_proxy.h |
| +++ b/cc/trees/single_thread_proxy.h |
| @@ -10,8 +10,10 @@ |
| #include "base/time/time.h" |
| #include "cc/animation/animation_events.h" |
| #include "cc/output/begin_frame_args.h" |
| +#include "cc/scheduler/scheduler.h" |
| #include "cc/trees/layer_tree_host_impl.h" |
| #include "cc/trees/proxy.h" |
| +#include "cc/trees/proxy_timing_history.h" |
| namespace cc { |
| @@ -19,7 +21,9 @@ class ContextProvider; |
| class LayerTreeHost; |
| class LayerTreeHostSingleThreadClient; |
| -class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| +class SingleThreadProxy : public Proxy, |
| + LayerTreeHostImplClient, |
| + SchedulerClient { |
| public: |
| static scoped_ptr<Proxy> Create( |
| LayerTreeHost* layer_tree_host, |
| @@ -52,13 +56,34 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| virtual void ForceSerializeOnSwapBuffers() OVERRIDE; |
| virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; |
| virtual bool CommitPendingForTesting() OVERRIDE; |
| + virtual scoped_ptr<base::Value> SchedulerStateAsValueForTesting() OVERRIDE; |
| + |
| + // SchedulerClient implementation |
| + virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE; |
| + virtual void ScheduledActionSendBeginMainFrame() OVERRIDE; |
| + virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() |
| + OVERRIDE; |
| + virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() OVERRIDE; |
| + virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() OVERRIDE; |
| + virtual void ScheduledActionCommit() OVERRIDE; |
| + virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE; |
| + virtual void ScheduledActionActivatePendingTree() OVERRIDE; |
| + virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE; |
| + virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
| + virtual void ScheduledActionManageTiles() OVERRIDE; |
| + virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; |
| + virtual base::TimeDelta DrawDurationEstimate() OVERRIDE; |
| + virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() OVERRIDE; |
| + virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE; |
| + virtual void PostBeginImplFrameDeadline(const base::Closure& closure, |
| + base::TimeTicks deadline) OVERRIDE; |
| + virtual void DidBeginImplFrameDeadline() OVERRIDE; |
| // LayerTreeHostImplClient implementation |
| virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; |
| virtual void DidSwapBuffersOnImplThread() OVERRIDE; |
| virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; |
| - virtual void BeginImplFrame(const BeginFrameArgs& args) |
| - OVERRIDE {} |
| + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; |
| virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; |
| virtual void NotifyReadyToActivate() OVERRIDE; |
| virtual void SetNeedsRedrawOnImplThread() OVERRIDE; |
| @@ -78,8 +103,8 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| virtual void RenewTreePriority() OVERRIDE {} |
| virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) |
| OVERRIDE {} |
| - virtual void DidActivatePendingTree() OVERRIDE {} |
| - virtual void DidManageTiles() OVERRIDE {} |
| + virtual void DidActivatePendingTree() OVERRIDE; |
| + virtual void DidManageTiles() OVERRIDE; |
| // Called by the legacy path where RenderWidget does the scheduling. |
| void CompositeImmediately(base::TimeTicks frame_begin_time); |
| @@ -89,20 +114,23 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| LayerTreeHostSingleThreadClient* client); |
| void OnOutputSurfaceInitializeAttempted(bool success); |
| - bool CommitAndComposite(base::TimeTicks frame_begin_time, |
| - const gfx::Rect& device_viewport_damage_rect, |
| - bool for_readback, |
| - LayerTreeHostImpl::FrameData* frame); |
| - void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); |
| - bool DoComposite(scoped_refptr<ContextProvider> offscreen_context_provider, |
| - base::TimeTicks frame_begin_time, |
| - const gfx::Rect& device_viewport_damage_rect, |
| - bool for_readback, |
| - LayerTreeHostImpl::FrameData* frame); |
| - void DidSwapFrame(); |
| + void DoCommit(base::TimeTicks frame_begin_time); |
| + DrawSwapReadbackResult::DrawResult DoComposite( |
| + scoped_refptr<ContextProvider> offscreen_context_provider, |
| + base::TimeTicks frame_begin_time, |
| + const gfx::Rect& device_viewport_damage_rect, |
| + bool for_readback, |
| + LayerTreeHostImpl::FrameData* frame); |
| + DrawSwapReadbackResult CommitAndCompositeInternal( |
| + base::TimeTicks frame_begin_time, |
| + gfx::Rect device_viewport_damage_rect, |
| + bool do_commit, |
| + bool for_readback); |
| + void DidCommitAndDrawFrame(); |
| bool ShouldComposite() const; |
| void UpdateBackgroundAnimateTicking(); |
| + scoped_refptr<ContextProvider> OffscreenContextProvider(); |
| // Accessed on main thread only. |
| LayerTreeHost* layer_tree_host_; |
| @@ -114,9 +142,18 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| RendererCapabilities renderer_capabilities_for_main_thread_; |
| + // Accessed from both threads. |
| + scoped_ptr<Scheduler> scheduler_on_impl_thread_; |
| + ProxyTimingHistory timing_history_; |
| + |
| + base::WeakPtrFactory<SingleThreadProxy> weak_factory_; |
|
danakj
2014/02/20 20:56:40
This should be the last member of the class.
enne (OOO)
2014/02/20 21:07:13
Done.
|
| + base::WeakPtr<SingleThreadProxy> weak_ptr_; |
| + |
| bool next_frame_is_newly_committed_frame_; |
| bool inside_draw_; |
| + bool defer_commits_; |
| + bool finish_commit_deferred_; |
| DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); |
| }; |