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