Index: cc/scheduler/scheduler_state_machine.cc |
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc |
index 1a444c9a158168283165a077085333c7b510b15e..81376a96b017f01cb65da6e93d3735e6d1d07f4c 100644 |
--- a/cc/scheduler/scheduler_state_machine.cc |
+++ b/cc/scheduler/scheduler_state_machine.cc |
@@ -463,9 +463,20 @@ bool SchedulerStateMachine::ShouldCommit() const { |
return false; |
} |
- // Prioritize drawing the previous commit before finishing the next commit. |
- if (active_tree_needs_first_draw_) |
- return false; |
+ if (settings_.impl_side_painting) { |
+ // Prioritize drawing the previous commit before finishing the next commit. |
+ bool active_tree_first_draw_is_imminent = |
+ active_tree_needs_first_draw_ && |
+ begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE && |
+ pending_swaps_ < max_pending_swaps_; |
+ if (active_tree_first_draw_is_imminent) |
+ return false; |
+ } else { |
+ // If we only have an active tree, it is incorrect to replace it |
+ // before we've drawn it. |
+ if (active_tree_needs_first_draw_) |
+ return false; |
+ } |
return true; |
} |