| Index: cc/scheduler/scheduler_state_machine.cc
|
| diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
|
| index 63ba4149a169400480d36ffef9885402ce341439..90602b62c39624f4c74f63b08eae7b5641c73e5f 100644
|
| --- a/cc/scheduler/scheduler_state_machine.cc
|
| +++ b/cc/scheduler/scheduler_state_machine.cc
|
| @@ -24,9 +24,9 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
|
| needs_forced_redraw_after_next_commit_(false),
|
| needs_commit_(false),
|
| needs_forced_commit_(false),
|
| - expect_immediate_begin_frame_(false),
|
| + expect_immediate_begin_main_fame_(false),
|
| main_thread_needs_layer_textures_(false),
|
| - inside_vsync_(false),
|
| + inside_begin_impl_frame_(false),
|
| visible_(false),
|
| can_start_(false),
|
| can_draw_(false),
|
| @@ -73,12 +73,13 @@ std::string SchedulerStateMachine::ToString() {
|
| base::StringAppendF(
|
| &str, "needs_forced_commit_ = %d; ", needs_forced_commit_);
|
| base::StringAppendF(&str,
|
| - "expect_immediate_begin_frame_ = %d; ",
|
| - expect_immediate_begin_frame_);
|
| + "expect_immediate_begin_main_fame_ = %d; ",
|
| + expect_immediate_begin_main_fame_);
|
| base::StringAppendF(&str,
|
| "main_thread_needs_layer_textures_ = %d; ",
|
| main_thread_needs_layer_textures_);
|
| - base::StringAppendF(&str, "inside_vsync_ = %d; ", inside_vsync_);
|
| + base::StringAppendF(&str, "inside_begin_impl_frame_ = %d; ",
|
| + inside_begin_impl_frame_);
|
| base::StringAppendF(&str, "visible_ = %d; ", visible_);
|
| base::StringAppendF(&str, "can_start_ = %d; ", can_start_);
|
| base::StringAppendF(&str, "can_draw_ = %d; ", can_draw_);
|
| @@ -129,7 +130,7 @@ bool SchedulerStateMachine::ShouldDraw() const {
|
|
|
| if (!ScheduledToDraw())
|
| return false;
|
| - if (!inside_vsync_)
|
| + if (!inside_begin_impl_frame_)
|
| return false;
|
| if (HasDrawnThisFrame())
|
| return false;
|
| @@ -139,7 +140,7 @@ bool SchedulerStateMachine::ShouldDraw() const {
|
| }
|
|
|
| bool SchedulerStateMachine::ShouldAttemptTreeActivation() const {
|
| - return has_pending_tree_ && inside_vsync_ &&
|
| + return has_pending_tree_ && inside_begin_impl_frame_ &&
|
| !HasAttemptedTreeActivationThisFrame();
|
| }
|
|
|
| @@ -163,7 +164,7 @@ bool SchedulerStateMachine::ShouldAcquireLayerTexturesForMainThread() const {
|
| // impl thread is not even scheduled to draw. Guards against deadlocking.
|
| if (!ScheduledToDraw())
|
| return true;
|
| - if (!VSyncCallbackNeeded())
|
| + if (!BeginMainFrameCallbackNeeded())
|
| return true;
|
| return false;
|
| }
|
| @@ -180,7 +181,7 @@ SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
|
| if (output_surface_state_ != OUTPUT_SURFACE_ACTIVE &&
|
| needs_forced_commit_)
|
| // TODO(enne): Should probably drop the active tree on force commit.
|
| - return has_pending_tree_ ? ACTION_NONE : ACTION_BEGIN_FRAME;
|
| + return has_pending_tree_ ? ACTION_NONE : ACTION_BEGIN_MAIN_FRAME;
|
| if (output_surface_state_ == OUTPUT_SURFACE_LOST && can_start_)
|
| return ACTION_BEGIN_OUTPUT_SURFACE_CREATION;
|
| if (output_surface_state_ == OUTPUT_SURFACE_CREATING)
|
| @@ -197,7 +198,7 @@ SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
|
| ((visible_ && output_surface_state_ == OUTPUT_SURFACE_ACTIVE)
|
| || needs_forced_commit_))
|
| // TODO(enne): Should probably drop the active tree on force commit.
|
| - return has_pending_tree_ ? ACTION_NONE : ACTION_BEGIN_FRAME;
|
| + return has_pending_tree_ ? ACTION_NONE : ACTION_BEGIN_MAIN_FRAME;
|
| return ACTION_NONE;
|
|
|
| case COMMIT_STATE_FRAME_IN_PROGRESS:
|
| @@ -228,7 +229,7 @@ SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
|
| // step (similar as in COMMIT_STATE_IDLE).
|
| bool can_commit = visible_ || needs_forced_commit_;
|
| if (needs_commit_ && can_commit && DrawSuspendedUntilCommit())
|
| - return has_pending_tree_ ? ACTION_NONE : ACTION_BEGIN_FRAME;
|
| + return has_pending_tree_ ? ACTION_NONE : ACTION_BEGIN_MAIN_FRAME;
|
| return ACTION_NONE;
|
| }
|
|
|
| @@ -260,7 +261,7 @@ void SchedulerStateMachine::UpdateState(Action action) {
|
| current_frame_number_;
|
| return;
|
|
|
| - case ACTION_BEGIN_FRAME:
|
| + case ACTION_BEGIN_MAIN_FRAME:
|
| DCHECK(!has_pending_tree_);
|
| DCHECK(visible_ || needs_forced_commit_);
|
| commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS;
|
| @@ -269,7 +270,7 @@ void SchedulerStateMachine::UpdateState(Action action) {
|
| return;
|
|
|
| case ACTION_COMMIT:
|
| - if (expect_immediate_begin_frame_)
|
| + if (expect_immediate_begin_main_fame_)
|
| commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW;
|
| else
|
| commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
|
| @@ -293,12 +294,12 @@ void SchedulerStateMachine::UpdateState(Action action) {
|
| needs_forced_redraw_ = false;
|
| draw_if_possible_failed_ = false;
|
| swap_used_incomplete_tile_ = false;
|
| - if (inside_vsync_)
|
| + if (inside_begin_impl_frame_)
|
| last_frame_number_where_draw_was_called_ = current_frame_number_;
|
| if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW) {
|
| - DCHECK(expect_immediate_begin_frame_);
|
| + DCHECK(expect_immediate_begin_main_fame_);
|
| commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS;
|
| - expect_immediate_begin_frame_ = false;
|
| + expect_immediate_begin_main_fame_ = false;
|
| } else if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) {
|
| commit_state_ = COMMIT_STATE_IDLE;
|
| }
|
| @@ -327,7 +328,7 @@ void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() {
|
| main_thread_needs_layer_textures_ = true;
|
| }
|
|
|
| -bool SchedulerStateMachine::VSyncCallbackNeeded() const {
|
| +bool SchedulerStateMachine::BeginMainFrameCallbackNeeded() const {
|
| // If we have a pending tree, need to keep getting notifications until
|
| // the tree is ready to be swapped.
|
| if (has_pending_tree_)
|
| @@ -347,11 +348,13 @@ bool SchedulerStateMachine::VSyncCallbackNeeded() const {
|
| output_surface_state_ == OUTPUT_SURFACE_ACTIVE;
|
| }
|
|
|
| -void SchedulerStateMachine::DidEnterVSync() { inside_vsync_ = true; }
|
| +void SchedulerStateMachine::DidEnterBeginImplFrame() {
|
| + inside_begin_impl_frame_ = true;
|
| +}
|
|
|
| -void SchedulerStateMachine::DidLeaveVSync() {
|
| +void SchedulerStateMachine::DidLeaveBeginImplFrame() {
|
| current_frame_number_++;
|
| - inside_vsync_ = false;
|
| + inside_begin_impl_frame_ = false;
|
| }
|
|
|
| void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; }
|
| @@ -389,20 +392,21 @@ void SchedulerStateMachine::SetNeedsCommit() { needs_commit_ = true; }
|
|
|
| void SchedulerStateMachine::SetNeedsForcedCommit() {
|
| needs_forced_commit_ = true;
|
| - expect_immediate_begin_frame_ = true;
|
| + expect_immediate_begin_main_fame_ = true;
|
| }
|
|
|
| -void SchedulerStateMachine::BeginFrameComplete() {
|
| +void SchedulerStateMachine::BeginMainFrameComplete() {
|
| DCHECK(commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS ||
|
| - (expect_immediate_begin_frame_ && commit_state_ != COMMIT_STATE_IDLE))
|
| + (expect_immediate_begin_main_fame_ &&
|
| + commit_state_ != COMMIT_STATE_IDLE))
|
| << ToString();
|
| commit_state_ = COMMIT_STATE_READY_TO_COMMIT;
|
| }
|
|
|
| -void SchedulerStateMachine::BeginFrameAborted() {
|
| +void SchedulerStateMachine::BeginMainFrameAborted() {
|
| DCHECK_EQ(commit_state_, COMMIT_STATE_FRAME_IN_PROGRESS);
|
| - if (expect_immediate_begin_frame_) {
|
| - expect_immediate_begin_frame_ = false;
|
| + if (expect_immediate_begin_main_fame_) {
|
| + expect_immediate_begin_main_fame_ = false;
|
| } else {
|
| commit_state_ = COMMIT_STATE_IDLE;
|
| SetNeedsCommit();
|
|
|