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

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 typo 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 616f5767b1e14c66b2a3fe669d92e31b1678c1b4..00d0d3d2978a9842fcae53c5bd3fde432a2286e2 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;
@@ -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,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_;
+
+ base::CancelableClosure output_surface_creation_callback_;
+
bool next_frame_is_newly_committed_frame_;
bool inside_draw_;
+ bool defer_commits_;
+ bool finish_commit_deferred_;
DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy);
};

Powered by Google App Engine
This is Rietveld 408576698