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

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

Issue 2339633003: Reland of cc: Remove frame queuing from the scheduler. (Closed)
Patch Set: post swap ack from CFS in fresh call stack Created 4 years, 3 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
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 // Do not queue too many swaps. 361 // Do not queue too many swaps.
362 if (SwapThrottled()) 362 if (SwapThrottled())
363 return false; 363 return false;
364 364
365 // Except for the cases above, do not draw outside of the BeginImplFrame 365 // Except for the cases above, do not draw outside of the BeginImplFrame
366 // deadline. 366 // deadline.
367 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) 367 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
368 return false; 368 return false;
369 369
370 if (wait_for_ready_to_draw_)
371 return false;
372
370 // Only handle forced redraws due to timeouts on the regular deadline. 373 // Only handle forced redraws due to timeouts on the regular deadline.
371 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) 374 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)
372 return true; 375 return true;
373 376
374 return needs_redraw_; 377 return needs_redraw_;
375 } 378 }
376 379
377 bool SchedulerStateMachine::ShouldActivatePendingTree() const { 380 bool SchedulerStateMachine::ShouldActivatePendingTree() const {
378 // There is nothing to activate. 381 // There is nothing to activate.
379 if (!has_pending_tree_) 382 if (!has_pending_tree_)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 bool SchedulerStateMachine::ShouldCommit() const { 480 bool SchedulerStateMachine::ShouldCommit() const {
478 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT) 481 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT)
479 return false; 482 return false;
480 483
481 // We must not finish the commit until the pending tree is free. 484 // We must not finish the commit until the pending tree is free.
482 if (has_pending_tree_) { 485 if (has_pending_tree_) {
483 DCHECK(settings_.main_frame_before_activation_enabled); 486 DCHECK(settings_.main_frame_before_activation_enabled);
484 return false; 487 return false;
485 } 488 }
486 489
490 // Active tree resources might still be in use until the Display draws.
491 if (settings_.commit_to_active_tree && SwapThrottled())
492 return false;
493
487 // If we only have an active tree, it is incorrect to replace it 494 // If we only have an active tree, it is incorrect to replace it
488 // before we've drawn it. 495 // before we've drawn it.
489 DCHECK(!settings_.commit_to_active_tree || !active_tree_needs_first_draw_); 496 DCHECK(!settings_.commit_to_active_tree || !active_tree_needs_first_draw_);
490 497
491 return true; 498 return true;
492 } 499 }
493 500
494 bool SchedulerStateMachine::ShouldPrepareTiles() const { 501 bool SchedulerStateMachine::ShouldPrepareTiles() const {
495 // PrepareTiles only really needs to be called immediately after commit 502 // PrepareTiles only really needs to be called immediately after commit
496 // and then periodically after that. Use a funnel to make sure we average 503 // and then periodically after that. Use a funnel to make sure we average
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 } 1029 }
1023 1030
1024 void SchedulerStateMachine::SetNeedsOneBeginImplFrame() { 1031 void SchedulerStateMachine::SetNeedsOneBeginImplFrame() {
1025 needs_one_begin_impl_frame_ = true; 1032 needs_one_begin_impl_frame_ = true;
1026 } 1033 }
1027 1034
1028 void SchedulerStateMachine::NotifyReadyToCommit() { 1035 void SchedulerStateMachine::NotifyReadyToCommit() {
1029 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED) 1036 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED)
1030 << AsValue()->ToString(); 1037 << AsValue()->ToString();
1031 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; 1038 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT;
1032 // In commit_to_active_tree mode, commit should happen right after
1033 // BeginFrame, meaning when this function is called, next action should be
1034 // commit.
1035 if (settings_.commit_to_active_tree)
1036 DCHECK(ShouldCommit());
1037 } 1039 }
1038 1040
1039 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { 1041 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) {
1040 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED); 1042 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED);
1041 1043
1042 // If the main thread aborted, it doesn't matter if the main thread missed 1044 // If the main thread aborted, it doesn't matter if the main thread missed
1043 // the last deadline since it didn't have an update anyway. 1045 // the last deadline since it didn't have an update anyway.
1044 main_thread_missed_last_deadline_ = false; 1046 main_thread_missed_last_deadline_ = false;
1045 1047
1046 switch (reason) { 1048 switch (reason) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 case COMPOSITOR_FRAME_SINK_ACTIVE: 1112 case COMPOSITOR_FRAME_SINK_ACTIVE:
1111 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: 1113 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT:
1112 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: 1114 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION:
1113 return true; 1115 return true;
1114 } 1116 }
1115 NOTREACHED(); 1117 NOTREACHED();
1116 return false; 1118 return false;
1117 } 1119 }
1118 1120
1119 } // namespace cc 1121 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698