| OLD | NEW |
| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 430 |
| 431 // We need a new commit for the forced redraw. This honors the | 431 // We need a new commit for the forced redraw. This honors the |
| 432 // single commit per interval because the result will be swapped to screen. | 432 // single commit per interval because the result will be swapped to screen. |
| 433 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) | 433 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) |
| 434 return true; | 434 return true; |
| 435 | 435 |
| 436 // We shouldn't normally accept commits if there isn't an OutputSurface. | 436 // We shouldn't normally accept commits if there isn't an OutputSurface. |
| 437 if (!HasInitializedOutputSurface()) | 437 if (!HasInitializedOutputSurface()) |
| 438 return false; | 438 return false; |
| 439 | 439 |
| 440 // SwapAck throttle the BeginMainFrames unless we just swapped. | |
| 441 // TODO(brianderson): Remove this restriction to improve throughput. | |
| 442 bool just_swapped_in_deadline = | |
| 443 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE && | |
| 444 did_perform_swap_in_last_draw_; | |
| 445 if (pending_swaps_ >= max_pending_swaps_ && !just_swapped_in_deadline) | |
| 446 return false; | |
| 447 | |
| 448 if (skip_begin_main_frame_to_reduce_latency_) | 440 if (skip_begin_main_frame_to_reduce_latency_) |
| 449 return false; | 441 return false; |
| 450 | 442 |
| 451 return true; | 443 return true; |
| 452 } | 444 } |
| 453 | 445 |
| 454 bool SchedulerStateMachine::ShouldCommit() const { | 446 bool SchedulerStateMachine::ShouldCommit() const { |
| 455 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT) | 447 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT) |
| 456 return false; | 448 return false; |
| 457 | 449 |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 static_cast<int>(begin_impl_frame_state_), | 1117 static_cast<int>(begin_impl_frame_state_), |
| 1126 static_cast<int>(commit_state_), | 1118 static_cast<int>(commit_state_), |
| 1127 has_pending_tree_ ? 'T' : 'F', | 1119 has_pending_tree_ ? 'T' : 'F', |
| 1128 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1120 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
| 1129 active_tree_needs_first_draw_ ? 'T' : 'F', | 1121 active_tree_needs_first_draw_ ? 'T' : 'F', |
| 1130 max_pending_swaps_, | 1122 max_pending_swaps_, |
| 1131 pending_swaps_); | 1123 pending_swaps_); |
| 1132 } | 1124 } |
| 1133 | 1125 |
| 1134 } // namespace cc | 1126 } // namespace cc |
| OLD | NEW |