diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 06:59:20 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 06:59:20 +0000 |
commit | 107fc127f06ac9d14ec1f68fae13077ab968c13a (patch) | |
tree | f925112610e38f7b1820c392b8356a8603aecd24 /cc/scheduler/scheduler.h | |
parent | 96d89f8411a85509c890f30d2dbb841211c31362 (diff) | |
download | chromium_src-107fc127f06ac9d14ec1f68fae13077ab968c13a.zip chromium_src-107fc127f06ac9d14ec1f68fae13077ab968c13a.tar.gz chromium_src-107fc127f06ac9d14ec1f68fae13077ab968c13a.tar.bz2 |
cc: Emulate BeginFrame in OutputSurfaces that don't support it natively
This includes two small fixes for the original version of this
patch that broke software compositing and WebView.
This will allow us to avoid having two different code paths
in the Scheduler. It also allows us to more easily remove the
VSyncTimeSource and FrameRateController from the Scheduler.
This patch instantiates the FrameRateController inside of
OutputSurface for now, but the FrameRateController could be
removed in future patches.
BUG=245920
BUG=243497
TBR=nduca@chromium.org,sievers@chromium.org,kbr@chromium.org
Review URL: https://chromiumcodereview.appspot.com/16833003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/scheduler/scheduler.h')
-rw-r--r-- | cc/scheduler/scheduler.h | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h index 6ecd889..d8151fa 100644 --- a/cc/scheduler/scheduler.h +++ b/cc/scheduler/scheduler.h @@ -11,7 +11,6 @@ #include "base/memory/scoped_ptr.h" #include "base/time.h" #include "cc/base/cc_export.h" -#include "cc/scheduler/frame_rate_controller.h" #include "cc/scheduler/scheduler_settings.h" #include "cc/scheduler/scheduler_state_machine.h" #include "cc/trees/layer_tree_host.h" @@ -33,6 +32,7 @@ struct ScheduledActionDrawAndSwapResult { class SchedulerClient { public: + virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0; virtual void ScheduledActionSendBeginFrameToMainThread() = 0; virtual ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapIfPossible() = 0; @@ -49,14 +49,12 @@ class SchedulerClient { virtual ~SchedulerClient() {} }; -class CC_EXPORT Scheduler : FrameRateControllerClient { +class CC_EXPORT Scheduler { public: static scoped_ptr<Scheduler> Create( SchedulerClient* client, - scoped_ptr<FrameRateController> frame_rate_controller, const SchedulerSettings& scheduler_settings) { - return make_scoped_ptr(new Scheduler( - client, frame_rate_controller.Pass(), scheduler_settings)); + return make_scoped_ptr(new Scheduler(client, scheduler_settings)); } virtual ~Scheduler(); @@ -86,12 +84,6 @@ class CC_EXPORT Scheduler : FrameRateControllerClient { void FinishCommit(); void BeginFrameAbortedByMainThread(); - void SetMaxFramesPending(int max); - int MaxFramesPending() const; - int NumFramesPendingForTesting() const; - - void DidSwapBuffersComplete(); - void DidLoseOutputSurface(); void DidCreateAndInitializeOutputSurface(); bool HasInitializedOutputSurface() const { @@ -103,28 +95,32 @@ class CC_EXPORT Scheduler : FrameRateControllerClient { bool WillDrawIfNeeded() const; - void SetTimebaseAndInterval(base::TimeTicks timebase, - base::TimeDelta interval); - base::TimeTicks AnticipatedDrawTime(); base::TimeTicks LastBeginFrameOnImplThreadTime(); - // FrameRateControllerClient implementation - virtual void BeginFrame(bool throttled) OVERRIDE; + void BeginFrame(base::TimeTicks frame_time); std::string StateAsStringForTesting() { return state_machine_.ToString(); } private: Scheduler(SchedulerClient* client, - scoped_ptr<FrameRateController> frame_rate_controller, const SchedulerSettings& scheduler_settings); + void SetupNextBeginFrameIfNeeded(); + void DrawAndSwapIfPossible(); + void DrawAndSwapForced(); void ProcessScheduledActions(); const SchedulerSettings settings_; SchedulerClient* client_; - scoped_ptr<FrameRateController> frame_rate_controller_; + + base::WeakPtrFactory<Scheduler> weak_factory_; + bool last_set_needs_begin_frame_; + bool has_pending_begin_frame_; + base::TimeTicks last_begin_frame_time_; + base::TimeDelta interval_; + SchedulerStateMachine state_machine_; bool inside_process_scheduled_actions_; |