Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 BeginFrameArgs::kInvalidFrameNumber), | 35 BeginFrameArgs::kInvalidFrameNumber), |
| 36 last_begin_frame_sequence_number_compositor_frame_was_fresh_( | 36 last_begin_frame_sequence_number_compositor_frame_was_fresh_( |
| 37 BeginFrameArgs::kInvalidFrameNumber), | 37 BeginFrameArgs::kInvalidFrameNumber), |
| 38 commit_count_(0), | 38 commit_count_(0), |
| 39 current_frame_number_(0), | 39 current_frame_number_(0), |
| 40 last_frame_number_submit_performed_(-1), | 40 last_frame_number_submit_performed_(-1), |
| 41 last_frame_number_draw_performed_(-1), | 41 last_frame_number_draw_performed_(-1), |
| 42 last_frame_number_begin_main_frame_sent_(-1), | 42 last_frame_number_begin_main_frame_sent_(-1), |
| 43 last_frame_number_invalidate_compositor_frame_sink_performed_(-1), | 43 last_frame_number_invalidate_compositor_frame_sink_performed_(-1), |
| 44 draw_funnel_(false), | 44 draw_funnel_(false), |
| 45 send_begin_main_frame_funnel_(true), | 45 did_send_begin_main_frame_for_current_frame_(true), |
| 46 invalidate_compositor_frame_sink_funnel_(false), | 46 invalidate_compositor_frame_sink_funnel_(false), |
| 47 impl_side_invalidation_funnel_(false), | 47 impl_side_invalidation_funnel_(false), |
| 48 did_notify_begin_main_frame_not_sent_(false), | |
| 49 did_commit_during_frame_(false), | |
| 48 prepare_tiles_funnel_(0), | 50 prepare_tiles_funnel_(0), |
| 49 consecutive_checkerboard_animations_(0), | 51 consecutive_checkerboard_animations_(0), |
| 50 pending_submit_frames_(0), | 52 pending_submit_frames_(0), |
| 51 submit_frames_with_current_compositor_frame_sink_(0), | 53 submit_frames_with_current_compositor_frame_sink_(0), |
| 52 needs_redraw_(false), | 54 needs_redraw_(false), |
| 53 needs_prepare_tiles_(false), | 55 needs_prepare_tiles_(false), |
| 54 needs_begin_main_frame_(false), | 56 needs_begin_main_frame_(false), |
| 55 needs_one_begin_impl_frame_(false), | 57 needs_one_begin_impl_frame_(false), |
| 56 visible_(false), | 58 visible_(false), |
| 57 begin_frame_source_paused_(false), | 59 begin_frame_source_paused_(false), |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 case ACTION_DRAW_ABORT: | 189 case ACTION_DRAW_ABORT: |
| 188 return "ACTION_DRAW_ABORT"; | 190 return "ACTION_DRAW_ABORT"; |
| 189 case ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION: | 191 case ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION: |
| 190 return "ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION"; | 192 return "ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION"; |
| 191 case ACTION_PREPARE_TILES: | 193 case ACTION_PREPARE_TILES: |
| 192 return "ACTION_PREPARE_TILES"; | 194 return "ACTION_PREPARE_TILES"; |
| 193 case ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: | 195 case ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: |
| 194 return "ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK"; | 196 return "ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK"; |
| 195 case ACTION_PERFORM_IMPL_SIDE_INVALIDATION: | 197 case ACTION_PERFORM_IMPL_SIDE_INVALIDATION: |
| 196 return "ACTION_PERFORM_IMPL_SIDE_INVALIDATION"; | 198 return "ACTION_PERFORM_IMPL_SIDE_INVALIDATION"; |
| 199 case ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT: | |
| 200 return "ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT"; | |
| 197 } | 201 } |
| 198 NOTREACHED(); | 202 NOTREACHED(); |
| 199 return "???"; | 203 return "???"; |
| 200 } | 204 } |
| 201 | 205 |
| 202 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 206 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 203 SchedulerStateMachine::AsValue() const { | 207 SchedulerStateMachine::AsValue() const { |
| 204 std::unique_ptr<base::trace_event::TracedValue> state( | 208 std::unique_ptr<base::trace_event::TracedValue> state( |
| 205 new base::trace_event::TracedValue()); | 209 new base::trace_event::TracedValue()); |
| 206 AsValueInto(state.get()); | 210 AsValueInto(state.get()); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 237 state->SetInteger("last_begin_frame_sequence_number_begin_main_frame_sent", | 241 state->SetInteger("last_begin_frame_sequence_number_begin_main_frame_sent", |
| 238 last_begin_frame_sequence_number_begin_main_frame_sent_); | 242 last_begin_frame_sequence_number_begin_main_frame_sent_); |
| 239 state->SetInteger("last_begin_frame_sequence_number_pending_tree_was_fresh", | 243 state->SetInteger("last_begin_frame_sequence_number_pending_tree_was_fresh", |
| 240 last_begin_frame_sequence_number_pending_tree_was_fresh_); | 244 last_begin_frame_sequence_number_pending_tree_was_fresh_); |
| 241 state->SetInteger("last_begin_frame_sequence_number_active_tree_was_fresh", | 245 state->SetInteger("last_begin_frame_sequence_number_active_tree_was_fresh", |
| 242 last_begin_frame_sequence_number_active_tree_was_fresh_); | 246 last_begin_frame_sequence_number_active_tree_was_fresh_); |
| 243 state->SetInteger( | 247 state->SetInteger( |
| 244 "last_begin_frame_sequence_number_compositor_frame_was_fresh", | 248 "last_begin_frame_sequence_number_compositor_frame_was_fresh", |
| 245 last_begin_frame_sequence_number_compositor_frame_was_fresh_); | 249 last_begin_frame_sequence_number_compositor_frame_was_fresh_); |
| 246 state->SetBoolean("funnel: draw_funnel", draw_funnel_); | 250 state->SetBoolean("funnel: draw_funnel", draw_funnel_); |
| 247 state->SetBoolean("funnel: send_begin_main_frame_funnel", | 251 state->SetBoolean("funnel: did_send_begin_main_frame", |
| 248 send_begin_main_frame_funnel_); | 252 did_send_begin_main_frame_for_current_frame_); |
| 253 state->SetBoolean("funnel: did_notify_begin_main_frame_not_sent", | |
| 254 did_notify_begin_main_frame_not_sent_); | |
| 255 state->SetBoolean("funnel: did_commit_during_frame", | |
| 256 did_commit_during_frame_); | |
| 249 state->SetInteger("funnel: prepare_tiles_funnel", prepare_tiles_funnel_); | 257 state->SetInteger("funnel: prepare_tiles_funnel", prepare_tiles_funnel_); |
| 250 state->SetBoolean("funnel: invalidate_compositor_frame_sink_funnel", | 258 state->SetBoolean("funnel: invalidate_compositor_frame_sink_funnel", |
| 251 invalidate_compositor_frame_sink_funnel_); | 259 invalidate_compositor_frame_sink_funnel_); |
| 252 state->SetBoolean("funnel: impl_side_invalidation_funnel", | 260 state->SetBoolean("funnel: impl_side_invalidation_funnel", |
| 253 impl_side_invalidation_funnel_); | 261 impl_side_invalidation_funnel_); |
| 254 state->SetInteger("consecutive_checkerboard_animations", | 262 state->SetInteger("consecutive_checkerboard_animations", |
| 255 consecutive_checkerboard_animations_); | 263 consecutive_checkerboard_animations_); |
| 256 state->SetInteger("pending_submit_frames_", pending_submit_frames_); | 264 state->SetInteger("pending_submit_frames_", pending_submit_frames_); |
| 257 state->SetInteger("submit_frames_with_current_compositor_frame_sink", | 265 state->SetInteger("submit_frames_with_current_compositor_frame_sink", |
| 258 submit_frames_with_current_compositor_frame_sink_); | 266 submit_frames_with_current_compositor_frame_sink_); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 return false; | 429 return false; |
| 422 | 430 |
| 423 // If we want to force activation, do so ASAP. | 431 // If we want to force activation, do so ASAP. |
| 424 if (PendingActivationsShouldBeForced()) | 432 if (PendingActivationsShouldBeForced()) |
| 425 return true; | 433 return true; |
| 426 | 434 |
| 427 // At this point, only activate if we are ready to activate. | 435 // At this point, only activate if we are ready to activate. |
| 428 return pending_tree_is_ready_for_activation_; | 436 return pending_tree_is_ready_for_activation_; |
| 429 } | 437 } |
| 430 | 438 |
| 439 bool SchedulerStateMachine::ShouldNotifyBeginMainFrameNotSent() const { | |
|
brianderson
2017/04/07 22:03:16
Is it okay that we'll be sending this at the start
Dan Elphick
2017/04/10 15:53:22
We're aware this might cause some problems, but we
| |
| 440 // This method returns true if most of the conditions for sending a | |
| 441 // BeginMainFrame are met, but one is not actually requested. This gives the | |
| 442 // main thread the chance to do something else. | |
| 443 | |
| 444 // Don't notify if a BeginMainFrame has already been requested. | |
| 445 if (needs_begin_main_frame_ || did_send_begin_main_frame_for_current_frame_) | |
|
brianderson
2017/04/07 22:03:16
I think the did_send_begin_main_frame_for_current_
Dan Elphick
2017/04/10 15:53:22
It is actually necessary as it's the flag is initi
| |
| 446 return false; | |
| 447 | |
| 448 // Only notify when we're visible. | |
| 449 if (!visible_) | |
| 450 return false; | |
| 451 | |
| 452 // There are no BeginImplFrames while BeginFrameSource is paused, meaning | |
| 453 // the scheduler should send SendBeginMainFrameNotExpectedSoon instead, | |
| 454 // indicating a longer period of inactivity. | |
| 455 if (begin_frame_source_paused_) | |
| 456 return false; | |
| 457 | |
| 458 // Do not notify that no BeginMainFrame was sent too many times in a single | |
| 459 // frame. | |
| 460 if (did_notify_begin_main_frame_not_sent_) | |
| 461 return false; | |
| 462 | |
| 463 // Do not notify if a commit happened during this frame as the main thread | |
| 464 // will already be active and does not need to be woken up to make further | |
| 465 // actions. (This occurs if the main frame was scheduled but didn't complete | |
| 466 // before the vsync deadline). | |
| 467 if (did_commit_during_frame_) | |
| 468 return false; | |
| 469 | |
| 470 // If a BeginMainFrame is in progress, there's no need to activate it. | |
| 471 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE) | |
|
brianderson
2017/04/07 22:03:16
Group this with the needs_begin_main_frame_ check
Dan Elphick
2017/04/10 15:53:22
Done.
| |
| 472 return false; | |
| 473 | |
| 474 return true; | |
| 475 } | |
| 476 | |
| 431 bool SchedulerStateMachine::CouldSendBeginMainFrame() const { | 477 bool SchedulerStateMachine::CouldSendBeginMainFrame() const { |
| 432 if (!needs_begin_main_frame_) | 478 if (!needs_begin_main_frame_) |
| 433 return false; | 479 return false; |
| 434 | 480 |
| 435 // We can not perform commits if we are not visible. | 481 // We can not perform commits if we are not visible. |
| 436 if (!visible_) | 482 if (!visible_) |
| 437 return false; | 483 return false; |
| 438 | 484 |
| 439 // There are no BeginImplFrames while BeginFrameSource is paused, | 485 // There are no BeginImplFrames while BeginFrameSource is paused, |
| 440 // so should also stop BeginMainFrames. | 486 // so should also stop BeginMainFrames. |
| 441 if (begin_frame_source_paused_) | 487 if (begin_frame_source_paused_) |
| 442 return false; | 488 return false; |
| 443 | 489 |
| 444 // Do not make a new commits when it is deferred. | 490 // Do not make a new commits when it is deferred. |
| 445 if (defer_commits_) | 491 if (defer_commits_) |
| 446 return false; | 492 return false; |
| 447 | 493 |
| 448 return true; | 494 return true; |
| 449 } | 495 } |
| 450 | 496 |
| 451 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { | 497 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { |
| 452 if (!CouldSendBeginMainFrame()) | 498 if (!CouldSendBeginMainFrame()) |
| 453 return false; | 499 return false; |
| 454 | 500 |
| 455 // Do not send begin main frame too many times in a single frame or before | 501 // Do not send begin main frame too many times in a single frame or before |
| 456 // the first BeginFrame. | 502 // the first BeginFrame. |
| 457 if (send_begin_main_frame_funnel_) | 503 if (did_send_begin_main_frame_for_current_frame_) |
| 458 return false; | 504 return false; |
| 459 | 505 |
| 460 // Only send BeginMainFrame when there isn't another commit pending already. | 506 // Only send BeginMainFrame when there isn't another commit pending already. |
| 461 // Other parts of the state machine indirectly defer the BeginMainFrame | 507 // Other parts of the state machine indirectly defer the BeginMainFrame |
| 462 // by transitioning to WAITING commit states rather than going | 508 // by transitioning to WAITING commit states rather than going |
| 463 // immediately to IDLE. | 509 // immediately to IDLE. |
| 464 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE) | 510 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE) |
| 465 return false; | 511 return false; |
| 466 | 512 |
| 467 // MFBA is disabled and we are waiting for previous activation. | 513 // MFBA is disabled and we are waiting for previous activation. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 if (ShouldPerformImplSideInvalidation()) | 637 if (ShouldPerformImplSideInvalidation()) |
| 592 return ACTION_PERFORM_IMPL_SIDE_INVALIDATION; | 638 return ACTION_PERFORM_IMPL_SIDE_INVALIDATION; |
| 593 if (ShouldPrepareTiles()) | 639 if (ShouldPrepareTiles()) |
| 594 return ACTION_PREPARE_TILES; | 640 return ACTION_PREPARE_TILES; |
| 595 if (ShouldSendBeginMainFrame()) | 641 if (ShouldSendBeginMainFrame()) |
| 596 return ACTION_SEND_BEGIN_MAIN_FRAME; | 642 return ACTION_SEND_BEGIN_MAIN_FRAME; |
| 597 if (ShouldInvalidateCompositorFrameSink()) | 643 if (ShouldInvalidateCompositorFrameSink()) |
| 598 return ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK; | 644 return ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK; |
| 599 if (ShouldBeginCompositorFrameSinkCreation()) | 645 if (ShouldBeginCompositorFrameSinkCreation()) |
| 600 return ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION; | 646 return ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION; |
| 647 if (ShouldNotifyBeginMainFrameNotSent()) | |
| 648 return ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT; | |
| 601 return ACTION_NONE; | 649 return ACTION_NONE; |
| 602 } | 650 } |
| 603 | 651 |
| 604 bool SchedulerStateMachine::ShouldPerformImplSideInvalidation() const { | 652 bool SchedulerStateMachine::ShouldPerformImplSideInvalidation() const { |
| 605 if (!needs_impl_side_invalidation_) | 653 if (!needs_impl_side_invalidation_) |
| 606 return false; | 654 return false; |
| 607 | 655 |
| 608 if (!CouldCreatePendingTree()) | 656 if (!CouldCreatePendingTree()) |
| 609 return false; | 657 return false; |
| 610 | 658 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 if (!HasInitializedCompositorFrameSink()) | 724 if (!HasInitializedCompositorFrameSink()) |
| 677 return false; | 725 return false; |
| 678 | 726 |
| 679 return true; | 727 return true; |
| 680 } | 728 } |
| 681 | 729 |
| 682 void SchedulerStateMachine::WillSendBeginMainFrame() { | 730 void SchedulerStateMachine::WillSendBeginMainFrame() { |
| 683 DCHECK(!has_pending_tree_ || settings_.main_frame_before_activation_enabled); | 731 DCHECK(!has_pending_tree_ || settings_.main_frame_before_activation_enabled); |
| 684 DCHECK(visible_); | 732 DCHECK(visible_); |
| 685 DCHECK(!begin_frame_source_paused_); | 733 DCHECK(!begin_frame_source_paused_); |
| 686 DCHECK(!send_begin_main_frame_funnel_); | 734 DCHECK(!did_send_begin_main_frame_for_current_frame_); |
| 687 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_SENT; | 735 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_SENT; |
| 688 needs_begin_main_frame_ = false; | 736 needs_begin_main_frame_ = false; |
| 689 send_begin_main_frame_funnel_ = true; | 737 did_send_begin_main_frame_for_current_frame_ = true; |
| 690 last_frame_number_begin_main_frame_sent_ = current_frame_number_; | 738 last_frame_number_begin_main_frame_sent_ = current_frame_number_; |
| 691 last_begin_frame_sequence_number_begin_main_frame_sent_ = | 739 last_begin_frame_sequence_number_begin_main_frame_sent_ = |
| 692 begin_frame_sequence_number_; | 740 begin_frame_sequence_number_; |
| 693 } | 741 } |
| 694 | 742 |
| 743 void SchedulerStateMachine::WillNotifyBeginMainFrameNotSent() { | |
| 744 DCHECK(visible_); | |
| 745 DCHECK(!begin_frame_source_paused_); | |
| 746 DCHECK(!did_notify_begin_main_frame_not_sent_); | |
| 747 did_notify_begin_main_frame_not_sent_ = true; | |
| 748 } | |
| 749 | |
| 695 void SchedulerStateMachine::WillCommit(bool commit_has_no_updates) { | 750 void SchedulerStateMachine::WillCommit(bool commit_has_no_updates) { |
| 696 bool can_have_pending_tree = | 751 bool can_have_pending_tree = |
| 697 commit_has_no_updates && | 752 commit_has_no_updates && |
| 698 (settings_.main_frame_before_activation_enabled || | 753 (settings_.main_frame_before_activation_enabled || |
| 699 current_pending_tree_is_impl_side_); | 754 current_pending_tree_is_impl_side_); |
| 700 DCHECK(!has_pending_tree_ || can_have_pending_tree); | 755 DCHECK(!has_pending_tree_ || can_have_pending_tree); |
| 701 commit_count_++; | 756 commit_count_++; |
| 702 last_commit_had_no_updates_ = commit_has_no_updates; | 757 last_commit_had_no_updates_ = commit_has_no_updates; |
| 703 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; | 758 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; |
| 759 did_commit_during_frame_ = true; | |
| 704 | 760 |
| 705 if (commit_has_no_updates) { | 761 if (commit_has_no_updates) { |
| 706 // Pending tree might still exist from prior commit. | 762 // Pending tree might still exist from prior commit. |
| 707 if (has_pending_tree_) { | 763 if (has_pending_tree_) { |
| 708 DCHECK(can_have_pending_tree); | 764 DCHECK(can_have_pending_tree); |
| 709 last_begin_frame_sequence_number_pending_tree_was_fresh_ = | 765 last_begin_frame_sequence_number_pending_tree_was_fresh_ = |
| 710 last_begin_frame_sequence_number_begin_main_frame_sent_; | 766 last_begin_frame_sequence_number_begin_main_frame_sent_; |
| 711 } else { | 767 } else { |
| 712 if (last_begin_frame_sequence_number_compositor_frame_was_fresh_ == | 768 if (last_begin_frame_sequence_number_compositor_frame_was_fresh_ == |
| 713 last_begin_frame_sequence_number_active_tree_was_fresh_) { | 769 last_begin_frame_sequence_number_active_tree_was_fresh_) { |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1040 | 1096 |
| 1041 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME; | 1097 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME; |
| 1042 current_frame_number_++; | 1098 current_frame_number_++; |
| 1043 | 1099 |
| 1044 last_commit_had_no_updates_ = false; | 1100 last_commit_had_no_updates_ = false; |
| 1045 did_draw_in_last_frame_ = false; | 1101 did_draw_in_last_frame_ = false; |
| 1046 did_submit_in_last_frame_ = false; | 1102 did_submit_in_last_frame_ = false; |
| 1047 needs_one_begin_impl_frame_ = false; | 1103 needs_one_begin_impl_frame_ = false; |
| 1048 | 1104 |
| 1049 // Clear funnels for any actions we perform during the frame. | 1105 // Clear funnels for any actions we perform during the frame. |
| 1050 send_begin_main_frame_funnel_ = false; | 1106 did_notify_begin_main_frame_not_sent_ = false; |
| 1107 did_send_begin_main_frame_for_current_frame_ = false; | |
| 1108 did_commit_during_frame_ = false; | |
| 1051 invalidate_compositor_frame_sink_funnel_ = false; | 1109 invalidate_compositor_frame_sink_funnel_ = false; |
| 1052 impl_side_invalidation_funnel_ = false; | 1110 impl_side_invalidation_funnel_ = false; |
| 1053 | 1111 |
| 1054 // "Drain" the PrepareTiles funnel. | 1112 // "Drain" the PrepareTiles funnel. |
| 1055 if (prepare_tiles_funnel_ > 0) | 1113 if (prepare_tiles_funnel_ > 0) |
| 1056 prepare_tiles_funnel_--; | 1114 prepare_tiles_funnel_--; |
| 1057 } | 1115 } |
| 1058 | 1116 |
| 1059 void SchedulerStateMachine::OnBeginImplFrameDeadline() { | 1117 void SchedulerStateMachine::OnBeginImplFrameDeadline() { |
| 1060 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE; | 1118 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1078 skip_next_begin_main_frame_to_reduce_latency_ = false; | 1136 skip_next_begin_main_frame_to_reduce_latency_ = false; |
| 1079 | 1137 |
| 1080 // If a new or undrawn active tree is pending after the deadline, | 1138 // If a new or undrawn active tree is pending after the deadline, |
| 1081 // then the main thread is in a high latency mode. | 1139 // then the main thread is in a high latency mode. |
| 1082 main_thread_missed_last_deadline_ = | 1140 main_thread_missed_last_deadline_ = |
| 1083 CommitPending() || has_pending_tree_ || active_tree_needs_first_draw_; | 1141 CommitPending() || has_pending_tree_ || active_tree_needs_first_draw_; |
| 1084 | 1142 |
| 1085 // If we're entering a state where we won't get BeginFrames set all the | 1143 // If we're entering a state where we won't get BeginFrames set all the |
| 1086 // funnels so that we don't perform any actions that we shouldn't. | 1144 // funnels so that we don't perform any actions that we shouldn't. |
| 1087 if (!BeginFrameNeeded()) | 1145 if (!BeginFrameNeeded()) |
| 1088 send_begin_main_frame_funnel_ = true; | 1146 did_send_begin_main_frame_for_current_frame_ = true; |
| 1089 | 1147 |
| 1090 // Synchronous compositor finishes BeginFrames before triggering their | 1148 // Synchronous compositor finishes BeginFrames before triggering their |
| 1091 // deadline. Therefore, we update sequence numbers when becoming idle, before | 1149 // deadline. Therefore, we update sequence numbers when becoming idle, before |
| 1092 // the Scheduler sends its BeginFrameAck. | 1150 // the Scheduler sends its BeginFrameAck. |
| 1093 if (settings_.using_synchronous_renderer_compositor) | 1151 if (settings_.using_synchronous_renderer_compositor) |
| 1094 UpdateBeginFrameSequenceNumbersForBeginFrameDeadline(); | 1152 UpdateBeginFrameSequenceNumbersForBeginFrameDeadline(); |
| 1095 } | 1153 } |
| 1096 | 1154 |
| 1097 SchedulerStateMachine::BeginImplFrameDeadlineMode | 1155 SchedulerStateMachine::BeginImplFrameDeadlineMode |
| 1098 SchedulerStateMachine::CurrentBeginImplFrameDeadlineMode() const { | 1156 SchedulerStateMachine::CurrentBeginImplFrameDeadlineMode() const { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1335 case COMPOSITOR_FRAME_SINK_ACTIVE: | 1393 case COMPOSITOR_FRAME_SINK_ACTIVE: |
| 1336 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: | 1394 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: |
| 1337 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: | 1395 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: |
| 1338 return true; | 1396 return true; |
| 1339 } | 1397 } |
| 1340 NOTREACHED(); | 1398 NOTREACHED(); |
| 1341 return false; | 1399 return false; |
| 1342 } | 1400 } |
| 1343 | 1401 |
| 1344 } // namespace cc | 1402 } // namespace cc |
| OLD | NEW |