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

Side by Side Diff: cc/scheduler/scheduler_state_machine.cc

Issue 1100943003: Don't defer commit until draw if not drawing soon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scheduler/scheduler_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 bool SchedulerStateMachine::ShouldCommit() const { 456 bool SchedulerStateMachine::ShouldCommit() const {
457 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT) 457 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT)
458 return false; 458 return false;
459 459
460 // We must not finish the commit until the pending tree is free. 460 // We must not finish the commit until the pending tree is free.
461 if (has_pending_tree_) { 461 if (has_pending_tree_) {
462 DCHECK(settings_.main_frame_before_activation_enabled); 462 DCHECK(settings_.main_frame_before_activation_enabled);
463 return false; 463 return false;
464 } 464 }
465 465
466 // Prioritize drawing the previous commit before finishing the next commit. 466 if (settings_.impl_side_painting) {
467 if (active_tree_needs_first_draw_) 467 // Prioritize drawing the previous commit before finishing the next commit.
468 return false; 468 bool active_tree_first_draw_is_imminent =
469 active_tree_needs_first_draw_ &&
470 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE &&
471 pending_swaps_ < max_pending_swaps_;
472 if (active_tree_first_draw_is_imminent)
473 return false;
474 } else {
475 // If we only have an active tree, it is incorrect to replace it
476 // before we've drawn it.
477 if (active_tree_needs_first_draw_)
478 return false;
479 }
469 480
470 return true; 481 return true;
471 } 482 }
472 483
473 bool SchedulerStateMachine::ShouldPrepareTiles() const { 484 bool SchedulerStateMachine::ShouldPrepareTiles() const {
474 // PrepareTiles only really needs to be called immediately after commit 485 // PrepareTiles only really needs to be called immediately after commit
475 // and then periodically after that. Use a funnel to make sure we average 486 // and then periodically after that. Use a funnel to make sure we average
476 // one PrepareTiles per BeginImplFrame in the long run. 487 // one PrepareTiles per BeginImplFrame in the long run.
477 if (prepare_tiles_funnel_ > 0) 488 if (prepare_tiles_funnel_ > 0)
478 return false; 489 return false;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 static_cast<int>(begin_impl_frame_state_), 1145 static_cast<int>(begin_impl_frame_state_),
1135 static_cast<int>(commit_state_), 1146 static_cast<int>(commit_state_),
1136 has_pending_tree_ ? 'T' : 'F', 1147 has_pending_tree_ ? 'T' : 'F',
1137 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1148 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1138 active_tree_needs_first_draw_ ? 'T' : 'F', 1149 active_tree_needs_first_draw_ ? 'T' : 'F',
1139 max_pending_swaps_, 1150 max_pending_swaps_,
1140 pending_swaps_); 1151 pending_swaps_);
1141 } 1152 }
1142 1153
1143 } // namespace cc 1154 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698