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

Unified Diff: cc/trees/single_thread_proxy.h

Issue 134623005: Make SingleThreadProxy a SchedulerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests; remove weak_ptr_ Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/single_thread_proxy.h
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index d96220b7d57f20d683d1917f8eadf02b4d1ca5ed..8a46089186586d1e02786c4ee850a802a418ff23 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,14 +56,35 @@ 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 UpdateRendererCapabilitiesOnImplThread() OVERRIDE;
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;
@@ -79,8 +104,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);
@@ -90,20 +115,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_;
@@ -115,9 +143,17 @@ 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_;
+
bool next_frame_is_newly_committed_frame_;
bool inside_draw_;
+ bool defer_commits_;
+ bool finish_commit_deferred_;
+
+ base::WeakPtrFactory<SingleThreadProxy> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy);
};

Powered by Google App Engine
This is Rietveld 408576698