| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 BeginMainFrameState state) { | 116 BeginMainFrameState state) { |
| 117 switch (state) { | 117 switch (state) { |
| 118 case BEGIN_MAIN_FRAME_STATE_IDLE: | 118 case BEGIN_MAIN_FRAME_STATE_IDLE: |
| 119 return "BEGIN_MAIN_FRAME_STATE_IDLE"; | 119 return "BEGIN_MAIN_FRAME_STATE_IDLE"; |
| 120 case BEGIN_MAIN_FRAME_STATE_SENT: | 120 case BEGIN_MAIN_FRAME_STATE_SENT: |
| 121 return "BEGIN_MAIN_FRAME_STATE_SENT"; | 121 return "BEGIN_MAIN_FRAME_STATE_SENT"; |
| 122 case BEGIN_MAIN_FRAME_STATE_STARTED: | 122 case BEGIN_MAIN_FRAME_STATE_STARTED: |
| 123 return "BEGIN_MAIN_FRAME_STATE_STARTED"; | 123 return "BEGIN_MAIN_FRAME_STATE_STARTED"; |
| 124 case BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT: | 124 case BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT: |
| 125 return "BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT"; | 125 return "BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT"; |
| 126 case BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION: |
| 127 return "BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION"; |
| 128 case BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW: |
| 129 return "BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW"; |
| 126 } | 130 } |
| 127 NOTREACHED(); | 131 NOTREACHED(); |
| 128 return "???"; | 132 return "???"; |
| 129 } | 133 } |
| 130 | 134 |
| 131 const char* SchedulerStateMachine::ForcedRedrawOnTimeoutStateToString( | 135 const char* SchedulerStateMachine::ForcedRedrawOnTimeoutStateToString( |
| 132 ForcedRedrawOnTimeoutState state) { | 136 ForcedRedrawOnTimeoutState state) { |
| 133 switch (state) { | 137 switch (state) { |
| 134 case FORCED_REDRAW_STATE_IDLE: | 138 case FORCED_REDRAW_STATE_IDLE: |
| 135 return "FORCED_REDRAW_STATE_IDLE"; | 139 return "FORCED_REDRAW_STATE_IDLE"; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 360 |
| 357 // Do not queue too many swaps. | 361 // Do not queue too many swaps. |
| 358 if (SwapThrottled()) | 362 if (SwapThrottled()) |
| 359 return false; | 363 return false; |
| 360 | 364 |
| 361 // 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 |
| 362 // deadline. | 366 // deadline. |
| 363 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) | 367 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) |
| 364 return false; | 368 return false; |
| 365 | 369 |
| 366 // Wait for active tree to be rasterized before drawing in browser compositor. | |
| 367 if (wait_for_ready_to_draw_) { | |
| 368 DCHECK(settings_.commit_to_active_tree); | |
| 369 return false; | |
| 370 } | |
| 371 | |
| 372 // Browser compositor commit steals any resources submitted in draw. Therefore | |
| 373 // drawing while a commit is pending is wasteful. | |
| 374 if (settings_.commit_to_active_tree && CommitPending()) | |
| 375 return false; | |
| 376 | |
| 377 // Only handle forced redraws due to timeouts on the regular deadline. | 370 // Only handle forced redraws due to timeouts on the regular deadline. |
| 378 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) | 371 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
| 379 return true; | 372 return true; |
| 380 | 373 |
| 381 return needs_redraw_; | 374 return needs_redraw_; |
| 382 } | 375 } |
| 383 | 376 |
| 384 bool SchedulerStateMachine::ShouldActivatePendingTree() const { | 377 bool SchedulerStateMachine::ShouldActivatePendingTree() const { |
| 385 // There is nothing to activate. | 378 // There is nothing to activate. |
| 386 if (!has_pending_tree_) | 379 if (!has_pending_tree_) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 if (send_begin_main_frame_funnel_) | 422 if (send_begin_main_frame_funnel_) |
| 430 return false; | 423 return false; |
| 431 | 424 |
| 432 // Only send BeginMainFrame when there isn't another commit pending already. | 425 // Only send BeginMainFrame when there isn't another commit pending already. |
| 433 // Other parts of the state machine indirectly defer the BeginMainFrame | 426 // Other parts of the state machine indirectly defer the BeginMainFrame |
| 434 // by transitioning to WAITING commit states rather than going | 427 // by transitioning to WAITING commit states rather than going |
| 435 // immediately to IDLE. | 428 // immediately to IDLE. |
| 436 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE) | 429 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE) |
| 437 return false; | 430 return false; |
| 438 | 431 |
| 439 // MFBA is disabled and we are waiting for previous activation. | |
| 440 if (!settings_.main_frame_before_activation_enabled && has_pending_tree_) | |
| 441 return false; | |
| 442 | |
| 443 // We are waiting for previous frame to be drawn, swapped and acked. | |
| 444 if (settings_.commit_to_active_tree && | |
| 445 (active_tree_needs_first_draw_ || SwapThrottled())) { | |
| 446 return false; | |
| 447 } | |
| 448 | |
| 449 // Don't send BeginMainFrame early if we are prioritizing the active tree | 432 // Don't send BeginMainFrame early if we are prioritizing the active tree |
| 450 // because of ImplLatencyTakesPriority. | 433 // because of ImplLatencyTakesPriority. |
| 451 if (ImplLatencyTakesPriority() && | 434 if (ImplLatencyTakesPriority() && |
| 452 (has_pending_tree_ || active_tree_needs_first_draw_)) { | 435 (has_pending_tree_ || active_tree_needs_first_draw_)) { |
| 453 return false; | 436 return false; |
| 454 } | 437 } |
| 455 | 438 |
| 456 // We should not send BeginMainFrame while we are in the idle state since we | 439 // We should not send BeginMainFrame while we are in the idle state since we |
| 457 // might have new user input arriving soon. It's okay to send BeginMainFrame | 440 // might have new user input arriving soon. It's okay to send BeginMainFrame |
| 458 // for the synchronous compositor because the main thread is always high | 441 // for the synchronous compositor because the main thread is always high |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 bool SchedulerStateMachine::ShouldCommit() const { | 477 bool SchedulerStateMachine::ShouldCommit() const { |
| 495 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT) | 478 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT) |
| 496 return false; | 479 return false; |
| 497 | 480 |
| 498 // We must not finish the commit until the pending tree is free. | 481 // We must not finish the commit until the pending tree is free. |
| 499 if (has_pending_tree_) { | 482 if (has_pending_tree_) { |
| 500 DCHECK(settings_.main_frame_before_activation_enabled); | 483 DCHECK(settings_.main_frame_before_activation_enabled); |
| 501 return false; | 484 return false; |
| 502 } | 485 } |
| 503 | 486 |
| 504 // If we only have an active tree, it is incorrect to replace it before we've | 487 // If we only have an active tree, it is incorrect to replace it |
| 505 // drawn it. | 488 // before we've drawn it. |
| 506 DCHECK(!settings_.commit_to_active_tree || !active_tree_needs_first_draw_); | 489 DCHECK(!settings_.commit_to_active_tree || !active_tree_needs_first_draw_); |
| 507 | 490 |
| 508 // In browser compositor commit reclaims any resources submitted during draw. | |
| 509 DCHECK(!settings_.commit_to_active_tree || !SwapThrottled()); | |
| 510 | |
| 511 return true; | 491 return true; |
| 512 } | 492 } |
| 513 | 493 |
| 514 bool SchedulerStateMachine::ShouldPrepareTiles() const { | 494 bool SchedulerStateMachine::ShouldPrepareTiles() const { |
| 515 // PrepareTiles only really needs to be called immediately after commit | 495 // PrepareTiles only really needs to be called immediately after commit |
| 516 // and then periodically after that. Use a funnel to make sure we average | 496 // and then periodically after that. Use a funnel to make sure we average |
| 517 // one PrepareTiles per BeginImplFrame in the long run. | 497 // one PrepareTiles per BeginImplFrame in the long run. |
| 518 if (prepare_tiles_funnel_ > 0) | 498 if (prepare_tiles_funnel_ > 0) |
| 519 return false; | 499 return false; |
| 520 | 500 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 send_begin_main_frame_funnel_ = true; | 559 send_begin_main_frame_funnel_ = true; |
| 580 last_frame_number_begin_main_frame_sent_ = current_frame_number_; | 560 last_frame_number_begin_main_frame_sent_ = current_frame_number_; |
| 581 } | 561 } |
| 582 | 562 |
| 583 void SchedulerStateMachine::WillCommit(bool commit_has_no_updates) { | 563 void SchedulerStateMachine::WillCommit(bool commit_has_no_updates) { |
| 584 DCHECK(!has_pending_tree_ || | 564 DCHECK(!has_pending_tree_ || |
| 585 (settings_.main_frame_before_activation_enabled && | 565 (settings_.main_frame_before_activation_enabled && |
| 586 commit_has_no_updates)); | 566 commit_has_no_updates)); |
| 587 commit_count_++; | 567 commit_count_++; |
| 588 last_commit_had_no_updates_ = commit_has_no_updates; | 568 last_commit_had_no_updates_ = commit_has_no_updates; |
| 589 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; | 569 |
| 570 if (commit_has_no_updates || settings_.main_frame_before_activation_enabled) { |
| 571 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; |
| 572 } else { |
| 573 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION; |
| 574 } |
| 590 | 575 |
| 591 if (!commit_has_no_updates) { | 576 if (!commit_has_no_updates) { |
| 592 // Pending tree only exists if commit had updates. | 577 // Pending tree only exists if commit had updates. |
| 593 has_pending_tree_ = true; | 578 has_pending_tree_ = true; |
| 594 pending_tree_is_ready_for_activation_ = false; | 579 pending_tree_is_ready_for_activation_ = false; |
| 595 wait_for_ready_to_draw_ = settings_.commit_to_active_tree; | 580 wait_for_ready_to_draw_ = settings_.commit_to_active_tree; |
| 596 } | 581 } |
| 597 | 582 |
| 598 // Update state related to forced draws. | 583 // Update state related to forced draws. |
| 599 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) { | 584 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) { |
| 600 forced_redraw_state_ = has_pending_tree_ | 585 forced_redraw_state_ = has_pending_tree_ |
| 601 ? FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION | 586 ? FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION |
| 602 : FORCED_REDRAW_STATE_WAITING_FOR_DRAW; | 587 : FORCED_REDRAW_STATE_WAITING_FOR_DRAW; |
| 603 } | 588 } |
| 604 | 589 |
| 605 // Update the output surface state. | 590 // Update the output surface state. |
| 606 if (compositor_frame_sink_state_ == | 591 if (compositor_frame_sink_state_ == |
| 607 COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT) { | 592 COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT) { |
| 608 compositor_frame_sink_state_ = | 593 compositor_frame_sink_state_ = |
| 609 has_pending_tree_ ? COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION | 594 has_pending_tree_ ? COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION |
| 610 : COMPOSITOR_FRAME_SINK_ACTIVE; | 595 : COMPOSITOR_FRAME_SINK_ACTIVE; |
| 611 } | 596 } |
| 612 } | 597 } |
| 613 | 598 |
| 614 void SchedulerStateMachine::WillActivate() { | 599 void SchedulerStateMachine::WillActivate() { |
| 600 if (begin_main_frame_state_ == |
| 601 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION) { |
| 602 begin_main_frame_state_ = settings_.commit_to_active_tree |
| 603 ? BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW |
| 604 : BEGIN_MAIN_FRAME_STATE_IDLE; |
| 605 } |
| 606 |
| 615 if (compositor_frame_sink_state_ == | 607 if (compositor_frame_sink_state_ == |
| 616 COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION) | 608 COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION) |
| 617 compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_ACTIVE; | 609 compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_ACTIVE; |
| 618 | 610 |
| 619 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION) | 611 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION) |
| 620 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW; | 612 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW; |
| 621 | 613 |
| 622 has_pending_tree_ = false; | 614 has_pending_tree_ = false; |
| 623 pending_tree_is_ready_for_activation_ = false; | 615 pending_tree_is_ready_for_activation_ = false; |
| 624 active_tree_needs_first_draw_ = true; | 616 active_tree_needs_first_draw_ = true; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 637 // draw itself might request another draw. | 629 // draw itself might request another draw. |
| 638 needs_redraw_ = false; | 630 needs_redraw_ = false; |
| 639 | 631 |
| 640 draw_funnel_ = true; | 632 draw_funnel_ = true; |
| 641 active_tree_needs_first_draw_ = false; | 633 active_tree_needs_first_draw_ = false; |
| 642 did_draw_in_last_frame_ = true; | 634 did_draw_in_last_frame_ = true; |
| 643 last_frame_number_draw_performed_ = current_frame_number_; | 635 last_frame_number_draw_performed_ = current_frame_number_; |
| 644 | 636 |
| 645 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) | 637 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
| 646 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; | 638 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; |
| 639 |
| 640 if (begin_main_frame_state_ == BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW) |
| 641 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; |
| 647 } | 642 } |
| 648 | 643 |
| 649 void SchedulerStateMachine::DidDrawInternal(DrawResult draw_result) { | 644 void SchedulerStateMachine::DidDrawInternal(DrawResult draw_result) { |
| 650 switch (draw_result) { | 645 switch (draw_result) { |
| 651 case INVALID_RESULT: | 646 case INVALID_RESULT: |
| 652 case DRAW_ABORTED_CANT_DRAW: | 647 case DRAW_ABORTED_CANT_DRAW: |
| 653 case DRAW_ABORTED_CONTEXT_LOST: | 648 case DRAW_ABORTED_CONTEXT_LOST: |
| 654 NOTREACHED() << "Invalid return DrawResult:" << draw_result; | 649 NOTREACHED() << "Invalid return DrawResult:" << draw_result; |
| 655 break; | 650 break; |
| 656 case DRAW_ABORTED_DRAINING_PIPELINE: | 651 case DRAW_ABORTED_DRAINING_PIPELINE: |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 // funnels so that we don't perform any actions that we shouldn't. | 864 // funnels so that we don't perform any actions that we shouldn't. |
| 870 if (!BeginFrameNeeded()) | 865 if (!BeginFrameNeeded()) |
| 871 send_begin_main_frame_funnel_ = true; | 866 send_begin_main_frame_funnel_ = true; |
| 872 } | 867 } |
| 873 | 868 |
| 874 SchedulerStateMachine::BeginImplFrameDeadlineMode | 869 SchedulerStateMachine::BeginImplFrameDeadlineMode |
| 875 SchedulerStateMachine::CurrentBeginImplFrameDeadlineMode() const { | 870 SchedulerStateMachine::CurrentBeginImplFrameDeadlineMode() const { |
| 876 if (settings_.using_synchronous_renderer_compositor) { | 871 if (settings_.using_synchronous_renderer_compositor) { |
| 877 // No deadline for synchronous compositor. | 872 // No deadline for synchronous compositor. |
| 878 return BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE; | 873 return BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE; |
| 879 } else if (wait_for_ready_to_draw_) { | |
| 880 // In browser compositor, wait for active tree to be rasterized. | |
| 881 DCHECK(settings_.commit_to_active_tree); | |
| 882 return BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW; | |
| 883 } else if (ShouldTriggerBeginImplFrameDeadlineImmediately()) { | 874 } else if (ShouldTriggerBeginImplFrameDeadlineImmediately()) { |
| 884 return BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE; | 875 return BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE; |
| 876 } else if (wait_for_ready_to_draw_) { |
| 877 // When we are waiting for ready to draw signal, we do not wait to post a |
| 878 // deadline yet. |
| 879 return BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW; |
| 885 } else if (needs_redraw_) { | 880 } else if (needs_redraw_) { |
| 886 // We have an animation or fast input path on the impl thread that wants | 881 // We have an animation or fast input path on the impl thread that wants |
| 887 // to draw, so don't wait too long for a new active tree. | 882 // to draw, so don't wait too long for a new active tree. |
| 888 return BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR; | 883 return BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR; |
| 889 } else { | 884 } else { |
| 890 // The impl thread doesn't have anything it wants to draw and we are just | 885 // The impl thread doesn't have anything it wants to draw and we are just |
| 891 // waiting for a new active tree. In short we are blocked. | 886 // waiting for a new active tree. In short we are blocked. |
| 892 return BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE; | 887 return BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE; |
| 893 } | 888 } |
| 894 } | 889 } |
| 895 | 890 |
| 896 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately() | 891 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately() |
| 897 const { | 892 const { |
| 898 // If we just forced activation, we should end the deadline right now. | 893 // If we just forced activation, we should end the deadline right now. |
| 899 if (PendingActivationsShouldBeForced() && !has_pending_tree_) | 894 if (PendingActivationsShouldBeForced() && !has_pending_tree_) |
| 900 return true; | 895 return true; |
| 901 | 896 |
| 897 // Do not trigger deadline immediately if we're waiting for READY_TO_DRAW |
| 898 // unless it's one of the forced cases. |
| 899 if (wait_for_ready_to_draw_) |
| 900 return false; |
| 901 |
| 902 // SwapAck throttle the deadline since we wont draw and swap anyway. | 902 // SwapAck throttle the deadline since we wont draw and swap anyway. |
| 903 if (SwapThrottled()) | 903 if (SwapThrottled()) |
| 904 return false; | 904 return false; |
| 905 | 905 |
| 906 if (active_tree_needs_first_draw_) | 906 if (active_tree_needs_first_draw_) |
| 907 return true; | 907 return true; |
| 908 | 908 |
| 909 if (!needs_redraw_) | 909 if (!needs_redraw_) |
| 910 return false; | 910 return false; |
| 911 | 911 |
| 912 // This is used to prioritize impl-thread draws when the main thread isn't | 912 // This is used to prioritize impl-thread draws when the main thread isn't |
| 913 // producing anything, e.g., after an aborted commit. We also check that we | 913 // producing anything, e.g., after an aborted commit. We also check that we |
| 914 // don't have a pending tree -- otherwise we should give it a chance to | 914 // don't have a pending tree -- otherwise we should give it a chance to |
| 915 // activate. | 915 // activate. |
| 916 // TODO(skyostil): Revisit this when we have more accurate deadline estimates. | 916 // TODO(skyostil): Revisit this when we have more accurate deadline estimates. |
| 917 if (!CommitPending() && !has_pending_tree_) | 917 if (begin_main_frame_state_ == BEGIN_MAIN_FRAME_STATE_IDLE && |
| 918 !has_pending_tree_) |
| 918 return true; | 919 return true; |
| 919 | 920 |
| 920 // Prioritize impl-thread draws in ImplLatencyTakesPriority mode. | 921 // Prioritize impl-thread draws in ImplLatencyTakesPriority mode. |
| 921 if (ImplLatencyTakesPriority()) | 922 if (ImplLatencyTakesPriority()) |
| 922 return true; | 923 return true; |
| 923 | 924 |
| 924 return false; | 925 return false; |
| 925 } | 926 } |
| 926 | 927 |
| 927 bool SchedulerStateMachine::SwapThrottled() const { | 928 bool SchedulerStateMachine::SwapThrottled() const { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 } | 1025 } |
| 1025 | 1026 |
| 1026 void SchedulerStateMachine::SetNeedsOneBeginImplFrame() { | 1027 void SchedulerStateMachine::SetNeedsOneBeginImplFrame() { |
| 1027 needs_one_begin_impl_frame_ = true; | 1028 needs_one_begin_impl_frame_ = true; |
| 1028 } | 1029 } |
| 1029 | 1030 |
| 1030 void SchedulerStateMachine::NotifyReadyToCommit() { | 1031 void SchedulerStateMachine::NotifyReadyToCommit() { |
| 1031 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED) | 1032 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED) |
| 1032 << AsValue()->ToString(); | 1033 << AsValue()->ToString(); |
| 1033 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; | 1034 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_READY_TO_COMMIT; |
| 1034 // In commit_to_active_tree mode, commit should happen right after BeginFrame, | 1035 // In commit_to_active_tree mode, commit should happen right after |
| 1035 // meaning when this function is called, next action should be commit. | 1036 // BeginFrame, meaning when this function is called, next action should be |
| 1037 // commit. |
| 1036 if (settings_.commit_to_active_tree) | 1038 if (settings_.commit_to_active_tree) |
| 1037 DCHECK(ShouldCommit()); | 1039 DCHECK(ShouldCommit()); |
| 1038 } | 1040 } |
| 1039 | 1041 |
| 1040 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 1042 void SchedulerStateMachine::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
| 1041 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED); | 1043 DCHECK_EQ(begin_main_frame_state_, BEGIN_MAIN_FRAME_STATE_STARTED); |
| 1042 | 1044 |
| 1043 // If the main thread aborted, it doesn't matter if the main thread missed | 1045 // If the main thread aborted, it doesn't matter if the main thread missed |
| 1044 // the last deadline since it didn't have an update anyway. | 1046 // the last deadline since it didn't have an update anyway. |
| 1045 main_thread_missed_last_deadline_ = false; | 1047 main_thread_missed_last_deadline_ = false; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 case COMPOSITOR_FRAME_SINK_ACTIVE: | 1113 case COMPOSITOR_FRAME_SINK_ACTIVE: |
| 1112 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: | 1114 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: |
| 1113 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: | 1115 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: |
| 1114 return true; | 1116 return true; |
| 1115 } | 1117 } |
| 1116 NOTREACHED(); | 1118 NOTREACHED(); |
| 1117 return false; | 1119 return false; |
| 1118 } | 1120 } |
| 1119 | 1121 |
| 1120 } // namespace cc | 1122 } // namespace cc |
| OLD | NEW |