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

Unified Diff: cc/scheduler/scheduler_state_machine.h

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: Many optimizations. Address comments. 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_state_machine.h
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 3784f6f3763391c656516ee448c2615e5ea6a474..bf797bb7b49a3942e1e5df2891828d4bac6449b4 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -31,10 +31,18 @@ class CC_EXPORT SchedulerStateMachine {
// settings must be valid for the lifetime of this class.
explicit SchedulerStateMachine(const SchedulerSettings& settings);
+ enum BeginFrameState {
brianderson 2013/06/21 01:27:20 Note: This version of the patch enforces the rule
+ BEGIN_FRAME_IDLE,
+ BEGIN_FRAME_STARTING,
+ BEGIN_FRAME_WAITING,
+ BEGIN_FRAME_DRAWING,
+ };
+
enum CommitState {
COMMIT_STATE_IDLE,
COMMIT_STATE_FRAME_IN_PROGRESS,
COMMIT_STATE_READY_TO_COMMIT,
+ COMMIT_STATE_WAITING_FOR_ACTIVATION,
COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW,
};
@@ -80,9 +88,10 @@ class CC_EXPORT SchedulerStateMachine {
// Indicates that the system has entered and left a BeginFrame callback.
// The scheduler will not draw more than once in a given BeginFrame
// callback.
- void DidEnterBeginFrame(const BeginFrameArgs& args);
- void DidLeaveBeginFrame();
- bool inside_begin_frame() const { return inside_begin_frame_; }
+ void OnBeginFrame(const BeginFrameArgs& args);
+ void OnBeginFrameDeadline();
+ bool ShouldTriggerBeginFrameDeadlineEarly() const;
+ bool InsideBeginFrame() const;
// Indicates whether the LayerTreeHostImpl is visible.
void SetVisible(bool visible);
@@ -161,13 +170,17 @@ class CC_EXPORT SchedulerStateMachine {
protected:
bool ShouldDrawForced() const;
bool ScheduledToDraw() const;
+ bool WillDrawNewTree() const;
bool ShouldDraw() const;
+ bool ShouldDrawInternal(BeginFrameState begin_frame_state) const;
bool ShouldAttemptTreeActivation() const;
bool ShouldAcquireLayerTexturesForMainThread() const;
bool ShouldCheckForCompletedTileUploads() const;
+ bool ShouldSendBeginFrameToMainThread() const;
bool HasDrawnThisFrame() const;
- bool HasAttemptedTreeActivationThisFrame() const;
- bool HasCheckedForCompletedTileUploadsThisFrame() const;
+ bool HasAttemptedTreeActivationThisFrameAttempt() const;
+ bool HasCheckedForCompletedTileUploadsThisFrameAttempt() const;
+ bool HasSentBeginFrameToMainThreadThisFrame() const;
const SchedulerSettings settings_;
@@ -175,9 +188,11 @@ class CC_EXPORT SchedulerStateMachine {
int commit_count_;
int current_frame_number_;
- int last_frame_number_where_draw_was_called_;
- int last_frame_number_where_tree_activation_attempted_;
- int last_frame_number_where_check_for_completed_tile_uploads_called_;
+ int current_frame_attempt_;
+ int last_frame_number_draw_was_called_;
+ int last_frame_number_begin_frame_sent_to_main_thread_;
+ int last_frame_attempt_tree_activation_attempted_;
+ int last_frame_attempt_check_for_completed_tile_uploads_called_;
int consecutive_failed_draws_;
int maximum_number_of_failed_draws_before_draw_is_forced_;
bool needs_redraw_;
@@ -188,7 +203,9 @@ class CC_EXPORT SchedulerStateMachine {
bool needs_forced_commit_;
bool expect_immediate_begin_frame_for_main_thread_;
bool main_thread_needs_layer_textures_;
- bool inside_begin_frame_;
+ BeginFrameState begin_frame_state_;
+ bool commit_tree_has_been_drawn_or_null_;
+ bool active_tree_has_been_drawn_or_null_;
BeginFrameArgs last_begin_frame_args_;
bool visible_;
bool can_start_;

Powered by Google App Engine
This is Rietveld 408576698