Index: trunk/src/cc/scheduler/scheduler.h |
=================================================================== |
--- trunk/src/cc/scheduler/scheduler.h (revision 206654) |
+++ trunk/src/cc/scheduler/scheduler.h (working copy) |
@@ -11,6 +11,7 @@ |
#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" |
@@ -32,7 +33,6 @@ |
class SchedulerClient { |
public: |
- virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0; |
virtual void ScheduledActionSendBeginFrameToMainThread() = 0; |
virtual ScheduledActionDrawAndSwapResult |
ScheduledActionDrawAndSwapIfPossible() = 0; |
@@ -50,12 +50,14 @@ |
virtual ~SchedulerClient() {} |
}; |
-class CC_EXPORT Scheduler { |
+class CC_EXPORT Scheduler : FrameRateControllerClient { |
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, scheduler_settings)); |
+ return make_scoped_ptr(new Scheduler( |
+ client, frame_rate_controller.Pass(), scheduler_settings)); |
} |
virtual ~Scheduler(); |
@@ -85,6 +87,12 @@ |
void FinishCommit(); |
void BeginFrameAbortedByMainThread(); |
+ void SetMaxFramesPending(int max); |
+ int MaxFramesPending() const; |
+ int NumFramesPendingForTesting() const; |
+ |
+ void DidSwapBuffersComplete(); |
+ |
void DidLoseOutputSurface(); |
void DidCreateAndInitializeOutputSurface(); |
bool HasInitializedOutputSurface() const { |
@@ -96,32 +104,28 @@ |
bool WillDrawIfNeeded() const; |
+ void SetTimebaseAndInterval(base::TimeTicks timebase, |
+ base::TimeDelta interval); |
+ |
base::TimeTicks AnticipatedDrawTime(); |
base::TimeTicks LastBeginFrameOnImplThreadTime(); |
- void BeginFrame(base::TimeTicks frame_time); |
+ // FrameRateControllerClient implementation |
+ virtual void BeginFrame(bool throttled) OVERRIDE; |
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_; |
- |
- 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_; |
- |
+ scoped_ptr<FrameRateController> frame_rate_controller_; |
SchedulerStateMachine state_machine_; |
bool inside_process_scheduled_actions_; |