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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "ui/gfx/frame_time.h" | 12 #include "ui/gfx/frame_time.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) | 16 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
17 : settings_(settings), | 17 : settings_(settings), |
18 output_surface_state_(OUTPUT_SURFACE_LOST), | 18 output_surface_state_(OUTPUT_SURFACE_LOST), |
19 begin_impl_frame_state_(BEGIN_IMPL_FRAME_STATE_IDLE), | 19 begin_impl_frame_state_(BEGIN_IMPL_FRAME_STATE_IDLE), |
20 commit_state_(COMMIT_STATE_IDLE), | 20 commit_state_(COMMIT_STATE_IDLE), |
21 forced_redraw_state_(FORCED_REDRAW_STATE_IDLE), | 21 forced_redraw_state_(FORCED_REDRAW_STATE_IDLE), |
22 readback_state_(READBACK_STATE_IDLE), | 22 readback_state_(READBACK_STATE_IDLE), |
23 commit_count_(0), | 23 commit_count_(0), |
24 current_frame_number_(0), | 24 current_frame_number_(0), |
25 last_frame_number_swap_performed_(-1), | 25 last_frame_number_swap_performed_(-1), |
26 last_frame_number_begin_main_frame_sent_(-1), | 26 last_frame_number_begin_main_frame_sent_(-1), |
27 last_frame_number_update_visible_tiles_was_called_(-1), | 27 last_frame_number_update_visible_tiles_was_called_(-1), |
28 manage_tiles_funnel_(0), | 28 manage_tiles_funnel_(0), |
29 consecutive_checkerboard_animations_(0), | 29 consecutive_checkerboard_animations_(0), |
| 30 max_pending_swaps_(1), |
| 31 pending_swaps_(0), |
30 needs_redraw_(false), | 32 needs_redraw_(false), |
31 needs_manage_tiles_(false), | 33 needs_manage_tiles_(false), |
32 swap_used_incomplete_tile_(false), | 34 swap_used_incomplete_tile_(false), |
33 needs_commit_(false), | 35 needs_commit_(false), |
34 inside_poll_for_anticipated_draw_triggers_(false), | 36 inside_poll_for_anticipated_draw_triggers_(false), |
35 visible_(false), | 37 visible_(false), |
36 can_start_(false), | 38 can_start_(false), |
37 can_draw_(false), | 39 can_draw_(false), |
38 has_pending_tree_(false), | 40 has_pending_tree_(false), |
39 pending_tree_is_ready_for_activation_(false), | 41 pending_tree_is_ready_for_activation_(false), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 minor_state->SetInteger( | 221 minor_state->SetInteger( |
220 "last_frame_number_begin_main_frame_sent", | 222 "last_frame_number_begin_main_frame_sent", |
221 last_frame_number_begin_main_frame_sent_); | 223 last_frame_number_begin_main_frame_sent_); |
222 minor_state->SetInteger( | 224 minor_state->SetInteger( |
223 "last_frame_number_update_visible_tiles_was_called", | 225 "last_frame_number_update_visible_tiles_was_called", |
224 last_frame_number_update_visible_tiles_was_called_); | 226 last_frame_number_update_visible_tiles_was_called_); |
225 | 227 |
226 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); | 228 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); |
227 minor_state->SetInteger("consecutive_checkerboard_animations", | 229 minor_state->SetInteger("consecutive_checkerboard_animations", |
228 consecutive_checkerboard_animations_); | 230 consecutive_checkerboard_animations_); |
| 231 minor_state->SetInteger("max_pending_swaps_", max_pending_swaps_); |
| 232 minor_state->SetInteger("pending_swaps_", pending_swaps_); |
229 minor_state->SetBoolean("needs_redraw", needs_redraw_); | 233 minor_state->SetBoolean("needs_redraw", needs_redraw_); |
230 minor_state->SetBoolean("needs_manage_tiles", needs_manage_tiles_); | 234 minor_state->SetBoolean("needs_manage_tiles", needs_manage_tiles_); |
231 minor_state->SetBoolean("swap_used_incomplete_tile", | 235 minor_state->SetBoolean("swap_used_incomplete_tile", |
232 swap_used_incomplete_tile_); | 236 swap_used_incomplete_tile_); |
233 minor_state->SetBoolean("needs_commit", needs_commit_); | 237 minor_state->SetBoolean("needs_commit", needs_commit_); |
234 minor_state->SetBoolean("visible", visible_); | 238 minor_state->SetBoolean("visible", visible_); |
235 minor_state->SetBoolean("can_start", can_start_); | 239 minor_state->SetBoolean("can_start", can_start_); |
236 minor_state->SetBoolean("can_draw", can_draw_); | 240 minor_state->SetBoolean("can_draw", can_draw_); |
237 minor_state->SetBoolean("has_pending_tree", has_pending_tree_); | 241 minor_state->SetBoolean("has_pending_tree", has_pending_tree_); |
238 minor_state->SetBoolean("pending_tree_is_ready_for_activation", | 242 minor_state->SetBoolean("pending_tree_is_ready_for_activation", |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // from occuring. If we are waiting for the first draw, then perfom the | 361 // from occuring. If we are waiting for the first draw, then perfom the |
358 // aborted draw to keep things moving. If we are not waiting for the first | 362 // aborted draw to keep things moving. If we are not waiting for the first |
359 // draw however, we don't want to abort for no reason. | 363 // draw however, we don't want to abort for no reason. |
360 if (PendingDrawsShouldBeAborted()) | 364 if (PendingDrawsShouldBeAborted()) |
361 return active_tree_needs_first_draw_; | 365 return active_tree_needs_first_draw_; |
362 | 366 |
363 // After this line, we only want to swap once per frame. | 367 // After this line, we only want to swap once per frame. |
364 if (HasSwappedThisFrame()) | 368 if (HasSwappedThisFrame()) |
365 return false; | 369 return false; |
366 | 370 |
| 371 // Do not queue too many swaps. |
| 372 if (pending_swaps_ >= max_pending_swaps_) |
| 373 return false; |
| 374 |
367 // Except for the cases above, do not draw outside of the BeginImplFrame | 375 // Except for the cases above, do not draw outside of the BeginImplFrame |
368 // deadline. | 376 // deadline. |
369 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) | 377 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) |
370 return false; | 378 return false; |
371 | 379 |
372 // Only handle forced redraws due to timeouts on the regular deadline. | 380 // Only handle forced redraws due to timeouts on the regular deadline. |
373 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) | 381 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
374 return true; | 382 return true; |
375 | 383 |
376 return needs_redraw_; | 384 return needs_redraw_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 return true; | 473 return true; |
466 | 474 |
467 // After this point, we only start a commit once per frame. | 475 // After this point, we only start a commit once per frame. |
468 if (HasSentBeginMainFrameThisFrame()) | 476 if (HasSentBeginMainFrameThisFrame()) |
469 return false; | 477 return false; |
470 | 478 |
471 // We shouldn't normally accept commits if there isn't an OutputSurface. | 479 // We shouldn't normally accept commits if there isn't an OutputSurface. |
472 if (!HasInitializedOutputSurface()) | 480 if (!HasInitializedOutputSurface()) |
473 return false; | 481 return false; |
474 | 482 |
| 483 // SwapAck throttle the BeginMainFrames |
| 484 // TODO(brianderson): Remove this restriction to improve throughput. |
| 485 if (pending_swaps_ >= max_pending_swaps_) |
| 486 return false; |
| 487 |
475 if (skip_begin_main_frame_to_reduce_latency_) | 488 if (skip_begin_main_frame_to_reduce_latency_) |
476 return false; | 489 return false; |
477 | 490 |
478 return true; | 491 return true; |
479 } | 492 } |
480 | 493 |
481 bool SchedulerStateMachine::ShouldCommit() const { | 494 bool SchedulerStateMachine::ShouldCommit() const { |
482 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT) | 495 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT) |
483 return false; | 496 return false; |
484 | 497 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 return; | 587 return; |
575 | 588 |
576 case ACTION_COMMIT: { | 589 case ACTION_COMMIT: { |
577 bool commit_was_aborted = false; | 590 bool commit_was_aborted = false; |
578 UpdateStateOnCommit(commit_was_aborted); | 591 UpdateStateOnCommit(commit_was_aborted); |
579 return; | 592 return; |
580 } | 593 } |
581 | 594 |
582 case ACTION_DRAW_AND_SWAP_FORCED: | 595 case ACTION_DRAW_AND_SWAP_FORCED: |
583 case ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { | 596 case ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { |
584 bool did_swap = true; | 597 bool did_request_swap = true; |
585 UpdateStateOnDraw(did_swap); | 598 UpdateStateOnDraw(did_request_swap); |
586 return; | 599 return; |
587 } | 600 } |
588 | 601 |
589 case ACTION_DRAW_AND_SWAP_ABORT: | 602 case ACTION_DRAW_AND_SWAP_ABORT: |
590 case ACTION_DRAW_AND_READBACK: { | 603 case ACTION_DRAW_AND_READBACK: { |
591 bool did_swap = false; | 604 bool did_request_swap = false; |
592 UpdateStateOnDraw(did_swap); | 605 UpdateStateOnDraw(did_request_swap); |
593 return; | 606 return; |
594 } | 607 } |
595 | 608 |
596 case ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 609 case ACTION_BEGIN_OUTPUT_SURFACE_CREATION: |
597 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_LOST); | 610 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_LOST); |
598 output_surface_state_ = OUTPUT_SURFACE_CREATING; | 611 output_surface_state_ = OUTPUT_SURFACE_CREATING; |
599 | 612 |
600 // The following DCHECKs make sure we are in the proper quiescent state. | 613 // The following DCHECKs make sure we are in the proper quiescent state. |
601 // The pipeline should be flushed entirely before we start output | 614 // The pipeline should be flushed entirely before we start output |
602 // surface creation to avoid complicated corner cases. | 615 // surface creation to avoid complicated corner cases. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 readback_state_ = READBACK_STATE_IDLE; | 732 readback_state_ = READBACK_STATE_IDLE; |
720 } | 733 } |
721 } | 734 } |
722 | 735 |
723 has_pending_tree_ = false; | 736 has_pending_tree_ = false; |
724 pending_tree_is_ready_for_activation_ = false; | 737 pending_tree_is_ready_for_activation_ = false; |
725 active_tree_needs_first_draw_ = true; | 738 active_tree_needs_first_draw_ = true; |
726 needs_redraw_ = true; | 739 needs_redraw_ = true; |
727 } | 740 } |
728 | 741 |
729 void SchedulerStateMachine::UpdateStateOnDraw(bool did_swap) { | 742 void SchedulerStateMachine::UpdateStateOnDraw(bool did_request_swap) { |
730 DCHECK(readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT && | 743 DCHECK(readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT && |
731 readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) | 744 readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) |
732 << *AsValue(); | 745 << *AsValue(); |
733 | 746 |
734 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) { | 747 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) { |
735 // The draw corresponds to a readback commit. | 748 // The draw corresponds to a readback commit. |
736 // We are blocking commits from the main thread until after this draw, so | 749 // We are blocking commits from the main thread until after this draw, so |
737 // we should not have a pending tree. | 750 // we should not have a pending tree. |
738 DCHECK(!has_pending_tree_); | 751 DCHECK(!has_pending_tree_); |
739 // We transition to COMMIT_STATE_BEGIN_MAIN_FRAME_SENT because there is a | 752 // We transition to COMMIT_STATE_BEGIN_MAIN_FRAME_SENT because there is a |
740 // pending BeginMainFrame behind the readback request. | 753 // pending BeginMainFrame behind the readback request. |
741 commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_SENT; | 754 commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_SENT; |
742 readback_state_ = READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT; | 755 readback_state_ = READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT; |
743 } else if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) { | 756 } else if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) { |
744 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; | 757 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; |
745 } | 758 } |
746 | 759 |
747 if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) | 760 if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) |
748 commit_state_ = COMMIT_STATE_IDLE; | 761 commit_state_ = COMMIT_STATE_IDLE; |
749 | 762 |
750 needs_redraw_ = false; | 763 needs_redraw_ = false; |
751 draw_if_possible_failed_ = false; | 764 draw_if_possible_failed_ = false; |
752 active_tree_needs_first_draw_ = false; | 765 active_tree_needs_first_draw_ = false; |
753 | 766 |
754 if (did_swap) | 767 if (did_request_swap) |
755 last_frame_number_swap_performed_ = current_frame_number_; | 768 last_frame_number_swap_performed_ = current_frame_number_; |
756 } | 769 } |
757 | 770 |
758 void SchedulerStateMachine::UpdateStateOnManageTiles() { | 771 void SchedulerStateMachine::UpdateStateOnManageTiles() { |
759 needs_manage_tiles_ = false; | 772 needs_manage_tiles_ = false; |
760 } | 773 } |
761 | 774 |
762 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { | 775 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { |
763 skip_next_begin_main_frame_to_reduce_latency_ = true; | 776 skip_next_begin_main_frame_to_reduce_latency_ = true; |
764 } | 777 } |
(...skipping 20 matching lines...) Expand all Loading... |
785 | 798 |
786 // Non synchronous compositors should rely on | 799 // Non synchronous compositors should rely on |
787 // ProactiveBeginFrameWanted to poll for state instead. | 800 // ProactiveBeginFrameWanted to poll for state instead. |
788 return false; | 801 return false; |
789 } | 802 } |
790 | 803 |
791 bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { | 804 bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { |
792 // Both the synchronous compositor and disabled vsync settings | 805 // Both the synchronous compositor and disabled vsync settings |
793 // make it undesirable to proactively request BeginImplFrames. | 806 // make it undesirable to proactively request BeginImplFrames. |
794 // If this is true, the scheduler should poll. | 807 // If this is true, the scheduler should poll. |
795 return !settings_.using_synchronous_renderer_compositor && | 808 return !settings_.using_synchronous_renderer_compositor; |
796 settings_.throttle_frame_production; | |
797 } | 809 } |
798 | 810 |
799 // These are the cases where we definitely (or almost definitely) have a | 811 // These are the cases where we definitely (or almost definitely) have a |
800 // new frame to draw and can draw. | 812 // new frame to draw and can draw. |
801 bool SchedulerStateMachine::BeginFrameNeededToDraw() const { | 813 bool SchedulerStateMachine::BeginFrameNeededToDraw() const { |
802 // The output surface is the provider of BeginImplFrames, so we are not going | 814 // The output surface is the provider of BeginImplFrames, so we are not going |
803 // to get them even if we ask for them. | 815 // to get them even if we ask for them. |
804 if (!HasInitializedOutputSurface()) | 816 if (!HasInitializedOutputSurface()) |
805 return false; | 817 return false; |
806 | 818 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 return false; | 913 return false; |
902 | 914 |
903 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) | 915 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) |
904 return false; | 916 return false; |
905 | 917 |
906 // If we've lost the output surface, end the current BeginImplFrame ASAP | 918 // If we've lost the output surface, end the current BeginImplFrame ASAP |
907 // so we can start creating the next output surface. | 919 // so we can start creating the next output surface. |
908 if (output_surface_state_ == OUTPUT_SURFACE_LOST) | 920 if (output_surface_state_ == OUTPUT_SURFACE_LOST) |
909 return true; | 921 return true; |
910 | 922 |
| 923 // SwapAck throttle the deadline since we wont draw and swap anyway. |
| 924 if (pending_swaps_ >= max_pending_swaps_) |
| 925 return false; |
| 926 |
911 if (active_tree_needs_first_draw_) | 927 if (active_tree_needs_first_draw_) |
912 return true; | 928 return true; |
913 | 929 |
914 if (!needs_redraw_) | 930 if (!needs_redraw_) |
915 return false; | 931 return false; |
916 | 932 |
917 // This is used to prioritize impl-thread draws when the main thread isn't | 933 // This is used to prioritize impl-thread draws when the main thread isn't |
918 // producing anything, e.g., after an aborted commit. We also check that we | 934 // producing anything, e.g., after an aborted commit. We also check that we |
919 // don't have a pending tree -- otherwise we should give it a chance to | 935 // don't have a pending tree -- otherwise we should give it a chance to |
920 // activate. | 936 // activate. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } | 1005 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } |
990 | 1006 |
991 void SchedulerStateMachine::SetNeedsManageTiles() { | 1007 void SchedulerStateMachine::SetNeedsManageTiles() { |
992 if (!needs_manage_tiles_) { | 1008 if (!needs_manage_tiles_) { |
993 TRACE_EVENT0("cc", | 1009 TRACE_EVENT0("cc", |
994 "SchedulerStateMachine::SetNeedsManageTiles"); | 1010 "SchedulerStateMachine::SetNeedsManageTiles"); |
995 needs_manage_tiles_ = true; | 1011 needs_manage_tiles_ = true; |
996 } | 1012 } |
997 } | 1013 } |
998 | 1014 |
| 1015 void SchedulerStateMachine::SetMaxSwapsPending(int max) { |
| 1016 max_pending_swaps_ = max; |
| 1017 } |
| 1018 |
| 1019 void SchedulerStateMachine::DidSwapBuffers() { |
| 1020 pending_swaps_++; |
| 1021 DCHECK_LE(pending_swaps_, max_pending_swaps_); |
| 1022 } |
| 1023 |
999 void SchedulerStateMachine::SetSwapUsedIncompleteTile( | 1024 void SchedulerStateMachine::SetSwapUsedIncompleteTile( |
1000 bool used_incomplete_tile) { | 1025 bool used_incomplete_tile) { |
1001 swap_used_incomplete_tile_ = used_incomplete_tile; | 1026 swap_used_incomplete_tile_ = used_incomplete_tile; |
1002 } | 1027 } |
1003 | 1028 |
| 1029 void SchedulerStateMachine::DidSwapBuffersComplete() { |
| 1030 DCHECK_GT(pending_swaps_, 0); |
| 1031 pending_swaps_--; |
| 1032 } |
| 1033 |
1004 void SchedulerStateMachine::SetSmoothnessTakesPriority( | 1034 void SchedulerStateMachine::SetSmoothnessTakesPriority( |
1005 bool smoothness_takes_priority) { | 1035 bool smoothness_takes_priority) { |
1006 smoothness_takes_priority_ = smoothness_takes_priority; | 1036 smoothness_takes_priority_ = smoothness_takes_priority; |
1007 } | 1037 } |
1008 | 1038 |
1009 void SchedulerStateMachine::DidDrawIfPossibleCompleted( | 1039 void SchedulerStateMachine::DidDrawIfPossibleCompleted( |
1010 DrawSwapReadbackResult::DrawResult result) { | 1040 DrawSwapReadbackResult::DrawResult result) { |
1011 switch (result) { | 1041 switch (result) { |
1012 case DrawSwapReadbackResult::INVALID_RESULT: | 1042 case DrawSwapReadbackResult::INVALID_RESULT: |
1013 NOTREACHED() << "Uninitialized DrawSwapReadbackResult."; | 1043 NOTREACHED() << "Uninitialized DrawSwapReadbackResult."; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() { | 1155 void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() { |
1126 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_CREATING); | 1156 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_CREATING); |
1127 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT; | 1157 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT; |
1128 | 1158 |
1129 if (did_create_and_initialize_first_output_surface_) { | 1159 if (did_create_and_initialize_first_output_surface_) { |
1130 // TODO(boliu): See if we can remove this when impl-side painting is always | 1160 // TODO(boliu): See if we can remove this when impl-side painting is always |
1131 // on. Does anything on the main thread need to update after recreate? | 1161 // on. Does anything on the main thread need to update after recreate? |
1132 needs_commit_ = true; | 1162 needs_commit_ = true; |
1133 } | 1163 } |
1134 did_create_and_initialize_first_output_surface_ = true; | 1164 did_create_and_initialize_first_output_surface_ = true; |
| 1165 pending_swaps_ = 0; |
1135 } | 1166 } |
1136 | 1167 |
1137 void SchedulerStateMachine::NotifyBeginMainFrameStarted() { | 1168 void SchedulerStateMachine::NotifyBeginMainFrameStarted() { |
1138 DCHECK_EQ(commit_state_, COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); | 1169 DCHECK_EQ(commit_state_, COMMIT_STATE_BEGIN_MAIN_FRAME_SENT); |
1139 | 1170 |
1140 DCHECK(readback_state_ == READBACK_STATE_IDLE || | 1171 DCHECK(readback_state_ == READBACK_STATE_IDLE || |
1141 readback_state_ == READBACK_STATE_WAITING_FOR_COMMIT || | 1172 readback_state_ == READBACK_STATE_WAITING_FOR_COMMIT || |
1142 readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT); | 1173 readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT); |
1143 | 1174 |
1144 commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED; | 1175 commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED; |
1145 } | 1176 } |
1146 | 1177 |
1147 bool SchedulerStateMachine::HasInitializedOutputSurface() const { | 1178 bool SchedulerStateMachine::HasInitializedOutputSurface() const { |
1148 switch (output_surface_state_) { | 1179 switch (output_surface_state_) { |
1149 case OUTPUT_SURFACE_LOST: | 1180 case OUTPUT_SURFACE_LOST: |
1150 case OUTPUT_SURFACE_CREATING: | 1181 case OUTPUT_SURFACE_CREATING: |
1151 return false; | 1182 return false; |
1152 | 1183 |
1153 case OUTPUT_SURFACE_ACTIVE: | 1184 case OUTPUT_SURFACE_ACTIVE: |
1154 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1185 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
1155 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1186 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
1156 return true; | 1187 return true; |
1157 } | 1188 } |
1158 NOTREACHED(); | 1189 NOTREACHED(); |
1159 return false; | 1190 return false; |
1160 } | 1191 } |
1161 | 1192 |
1162 } // namespace cc | 1193 } // namespace cc |
OLD | NEW |