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

Unified Diff: cc/scheduler/scheduler.h

Issue 15836005: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc
Patch Set: Fix checkerboard; Track pending swaps; Created 7 years, 6 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/scheduler/scheduler.h
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index aec0cdf2b56dcb4e801f41af44f165831ae3205d..48b4e387ae2fea61b1ba1ee51f4404eccf8c3c64 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -33,6 +33,7 @@ struct ScheduledActionDrawAndSwapResult {
class SchedulerClient {
public:
+ virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0;
virtual void ScheduledActionSendBeginFrameToMainThread() = 0;
virtual ScheduledActionDrawAndSwapResult
ScheduledActionDrawAndSwapIfPossible() = 0;
@@ -49,14 +50,13 @@ 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));
+ const SchedulerSettings& scheduler_settings,
+ Thread* thread) {
nduca 2013/06/04 04:53:59 So, typically the only thing in cc that gets to po
brianderson 2013/06/04 18:33:27 That sounds like a good restriction to have. I bro
+ return make_scoped_ptr(new Scheduler(client, scheduler_settings, thread));
}
virtual ~Scheduler();
@@ -86,13 +86,6 @@ class CC_EXPORT Scheduler : FrameRateControllerClient {
void FinishCommit();
void BeginFrameAbortedByMainThread();
- void SetMaxFramesPending(int max);
- int MaxFramesPending() const;
- int NumFramesPendingForTesting() const;
-
- void SetSwapBuffersCompleteSupported(bool supported);
- void DidSwapBuffersComplete();
-
void DidLoseOutputSurface();
void DidCreateAndInitializeOutputSurface();
bool HasInitializedOutputSurface() const {
@@ -104,28 +97,37 @@ 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);
nduca 2013/06/04 04:53:59 an explanation of what these mean would be good. I
brianderson 2013/06/04 18:33:27 Added the following comments: // BeginFrame get
+ void BeginFrameRetry();
std::string StateAsStringForTesting() { return state_machine_.ToString(); }
private:
Scheduler(SchedulerClient* client,
- scoped_ptr<FrameRateController> frame_rate_controller,
- const SchedulerSettings& scheduler_settings);
+ const SchedulerSettings& scheduler_settings,
+ Thread* thread);
+ void SetupNextBeginFrameIfNeeded();
+ void DrawAndSwapIfPossible();
+ void DrawAndSwapForced();
void ProcessScheduledActions();
const SchedulerSettings settings_;
SchedulerClient* client_;
- scoped_ptr<FrameRateController> frame_rate_controller_;
+
+ base::WeakPtrFactory<Scheduler> weak_factory_;
+ Thread* thread_;
+ bool last_set_needs_begin_frame_;
+ int pending_begin_frames_;
+ int incomplete_swaps_;
nduca 2013/06/04 04:53:59 what are incomplete swaps?
brianderson 2013/06/04 18:33:27 This should go away. I was using this to debug the
+ base::TimeTicks last_begin_frame_time_;
+ base::TimeTicks anticipated_draw_time_;
nduca 2013/06/04 04:53:59 this is the deadline, right? Calling it anticipate
brianderson 2013/06/04 18:33:27 The variable corresponds to the AnticipatedDrawTim
+ base::TimeDelta interval_;
+
SchedulerStateMachine state_machine_;
bool inside_process_scheduled_actions_;

Powered by Google App Engine
This is Rietveld 408576698