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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 return false; | 381 return false; |
382 | 382 |
383 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING && | 383 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING && |
384 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) | 384 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) |
385 return false; | 385 return false; |
386 | 386 |
387 return needs_redraw_ || needs_animate_; | 387 return needs_redraw_ || needs_animate_; |
388 } | 388 } |
389 | 389 |
390 bool SchedulerStateMachine::CouldSendBeginMainFrame() const { | 390 bool SchedulerStateMachine::CouldSendBeginMainFrame() const { |
391 // Do not send begin main frame too many times in a single frame. | |
392 if (send_begin_main_frame_funnel_) | |
393 return false; | |
394 | |
395 if (!needs_commit_) | 391 if (!needs_commit_) |
396 return false; | 392 return false; |
397 | 393 |
398 // We can not perform commits if we are not visible. | 394 // We can not perform commits if we are not visible. |
399 if (!visible_) | 395 if (!visible_) |
400 return false; | 396 return false; |
401 | 397 |
402 // Do not make a new commits when it is deferred. | 398 // Do not make a new commits when it is deferred. |
403 if (defer_commits_) | 399 if (defer_commits_) |
404 return false; | 400 return false; |
405 | 401 |
406 return true; | 402 return true; |
407 } | 403 } |
408 | 404 |
409 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { | 405 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { |
410 if (!CouldSendBeginMainFrame()) | 406 if (!CouldSendBeginMainFrame()) |
411 return false; | 407 return false; |
412 | 408 |
| 409 // Do not send begin main frame too many times in a single frame. |
| 410 if (send_begin_main_frame_funnel_) |
| 411 return false; |
| 412 |
413 // Only send BeginMainFrame when there isn't another commit pending already. | 413 // Only send BeginMainFrame when there isn't another commit pending already. |
414 if (commit_state_ != COMMIT_STATE_IDLE) | 414 if (commit_state_ != COMMIT_STATE_IDLE) |
415 return false; | 415 return false; |
416 | 416 |
417 // Don't send BeginMainFrame early if we are prioritizing the active tree | 417 // Don't send BeginMainFrame early if we are prioritizing the active tree |
418 // because of impl_latency_takes_priority_. | 418 // because of impl_latency_takes_priority_. |
419 if (impl_latency_takes_priority_ && | 419 if (impl_latency_takes_priority_ && |
420 (has_pending_tree_ || active_tree_needs_first_draw_)) { | 420 (has_pending_tree_ || active_tree_needs_first_draw_)) { |
421 return false; | 421 return false; |
422 } | 422 } |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 static_cast<int>(begin_impl_frame_state_), | 1134 static_cast<int>(begin_impl_frame_state_), |
1135 static_cast<int>(commit_state_), | 1135 static_cast<int>(commit_state_), |
1136 has_pending_tree_ ? 'T' : 'F', | 1136 has_pending_tree_ ? 'T' : 'F', |
1137 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1137 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
1138 active_tree_needs_first_draw_ ? 'T' : 'F', | 1138 active_tree_needs_first_draw_ ? 'T' : 'F', |
1139 max_pending_swaps_, | 1139 max_pending_swaps_, |
1140 pending_swaps_); | 1140 pending_swaps_); |
1141 } | 1141 } |
1142 | 1142 |
1143 } // namespace cc | 1143 } // namespace cc |
OLD | NEW |