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_animate_performed_(-1), |
25 last_frame_number_swap_performed_(-1), | 26 last_frame_number_swap_performed_(-1), |
26 last_frame_number_begin_main_frame_sent_(-1), | 27 last_frame_number_begin_main_frame_sent_(-1), |
27 last_frame_number_update_visible_tiles_was_called_(-1), | 28 last_frame_number_update_visible_tiles_was_called_(-1), |
28 manage_tiles_funnel_(0), | 29 manage_tiles_funnel_(0), |
29 consecutive_checkerboard_animations_(0), | 30 consecutive_checkerboard_animations_(0), |
30 max_pending_swaps_(1), | 31 max_pending_swaps_(1), |
31 pending_swaps_(0), | 32 pending_swaps_(0), |
32 needs_redraw_(false), | 33 needs_redraw_(false), |
| 34 needs_animate_(false), |
33 needs_manage_tiles_(false), | 35 needs_manage_tiles_(false), |
34 swap_used_incomplete_tile_(false), | 36 swap_used_incomplete_tile_(false), |
35 needs_commit_(false), | 37 needs_commit_(false), |
36 inside_poll_for_anticipated_draw_triggers_(false), | 38 inside_poll_for_anticipated_draw_triggers_(false), |
37 visible_(false), | 39 visible_(false), |
38 can_start_(false), | 40 can_start_(false), |
39 can_draw_(false), | 41 can_draw_(false), |
40 has_pending_tree_(false), | 42 has_pending_tree_(false), |
41 pending_tree_is_ready_for_activation_(false), | 43 pending_tree_is_ready_for_activation_(false), |
42 active_tree_needs_first_draw_(false), | 44 active_tree_needs_first_draw_(false), |
43 draw_if_possible_failed_(false), | 45 draw_if_possible_failed_(false), |
44 did_create_and_initialize_first_output_surface_(false), | 46 did_create_and_initialize_first_output_surface_(false), |
45 smoothness_takes_priority_(false), | 47 smoothness_takes_priority_(false), |
46 skip_next_begin_main_frame_to_reduce_latency_(false), | 48 skip_next_begin_main_frame_to_reduce_latency_(false), |
47 skip_begin_main_frame_to_reduce_latency_(false), | 49 skip_begin_main_frame_to_reduce_latency_(false), |
48 continuous_painting_(false), | 50 continuous_painting_(false), |
49 needs_back_to_back_readback_(false) {} | 51 needs_back_to_back_readback_(false) { |
| 52 } |
50 | 53 |
51 const char* SchedulerStateMachine::OutputSurfaceStateToString( | 54 const char* SchedulerStateMachine::OutputSurfaceStateToString( |
52 OutputSurfaceState state) { | 55 OutputSurfaceState state) { |
53 switch (state) { | 56 switch (state) { |
54 case OUTPUT_SURFACE_ACTIVE: | 57 case OUTPUT_SURFACE_ACTIVE: |
55 return "OUTPUT_SURFACE_ACTIVE"; | 58 return "OUTPUT_SURFACE_ACTIVE"; |
56 case OUTPUT_SURFACE_LOST: | 59 case OUTPUT_SURFACE_LOST: |
57 return "OUTPUT_SURFACE_LOST"; | 60 return "OUTPUT_SURFACE_LOST"; |
58 case OUTPUT_SURFACE_CREATING: | 61 case OUTPUT_SURFACE_CREATING: |
59 return "OUTPUT_SURFACE_CREATING"; | 62 return "OUTPUT_SURFACE_CREATING"; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return "FORCED_REDRAW_STATE_WAITING_FOR_DRAW"; | 139 return "FORCED_REDRAW_STATE_WAITING_FOR_DRAW"; |
137 } | 140 } |
138 NOTREACHED(); | 141 NOTREACHED(); |
139 return "???"; | 142 return "???"; |
140 } | 143 } |
141 | 144 |
142 const char* SchedulerStateMachine::ActionToString(Action action) { | 145 const char* SchedulerStateMachine::ActionToString(Action action) { |
143 switch (action) { | 146 switch (action) { |
144 case ACTION_NONE: | 147 case ACTION_NONE: |
145 return "ACTION_NONE"; | 148 return "ACTION_NONE"; |
| 149 case ACTION_ANIMATE: |
| 150 return "ACTION_ANIMATE"; |
146 case ACTION_SEND_BEGIN_MAIN_FRAME: | 151 case ACTION_SEND_BEGIN_MAIN_FRAME: |
147 return "ACTION_SEND_BEGIN_MAIN_FRAME"; | 152 return "ACTION_SEND_BEGIN_MAIN_FRAME"; |
148 case ACTION_COMMIT: | 153 case ACTION_COMMIT: |
149 return "ACTION_COMMIT"; | 154 return "ACTION_COMMIT"; |
150 case ACTION_UPDATE_VISIBLE_TILES: | 155 case ACTION_UPDATE_VISIBLE_TILES: |
151 return "ACTION_UPDATE_VISIBLE_TILES"; | 156 return "ACTION_UPDATE_VISIBLE_TILES"; |
152 case ACTION_ACTIVATE_PENDING_TREE: | 157 case ACTION_ACTIVATE_PENDING_TREE: |
153 return "ACTION_ACTIVATE_PENDING_TREE"; | 158 return "ACTION_ACTIVATE_PENDING_TREE"; |
154 case ACTION_DRAW_AND_SWAP_IF_POSSIBLE: | 159 case ACTION_DRAW_AND_SWAP_IF_POSSIBLE: |
155 return "ACTION_DRAW_AND_SWAP_IF_POSSIBLE"; | 160 return "ACTION_DRAW_AND_SWAP_IF_POSSIBLE"; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 timestamps_state->SetDouble( | 214 timestamps_state->SetDouble( |
210 "6_deadline", | 215 "6_deadline", |
211 (begin_impl_frame_args_.deadline - base::TimeTicks()).InMicroseconds() / | 216 (begin_impl_frame_args_.deadline - base::TimeTicks()).InMicroseconds() / |
212 1000.0L); | 217 1000.0L); |
213 state->Set("major_timestamps_in_ms", timestamps_state.release()); | 218 state->Set("major_timestamps_in_ms", timestamps_state.release()); |
214 | 219 |
215 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue); | 220 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue); |
216 minor_state->SetInteger("commit_count", commit_count_); | 221 minor_state->SetInteger("commit_count", commit_count_); |
217 minor_state->SetInteger("current_frame_number", current_frame_number_); | 222 minor_state->SetInteger("current_frame_number", current_frame_number_); |
218 | 223 |
| 224 minor_state->SetInteger("last_frame_number_animate_performed", |
| 225 last_frame_number_animate_performed_); |
219 minor_state->SetInteger("last_frame_number_swap_performed", | 226 minor_state->SetInteger("last_frame_number_swap_performed", |
220 last_frame_number_swap_performed_); | 227 last_frame_number_swap_performed_); |
221 minor_state->SetInteger( | 228 minor_state->SetInteger( |
222 "last_frame_number_begin_main_frame_sent", | 229 "last_frame_number_begin_main_frame_sent", |
223 last_frame_number_begin_main_frame_sent_); | 230 last_frame_number_begin_main_frame_sent_); |
224 minor_state->SetInteger( | 231 minor_state->SetInteger( |
225 "last_frame_number_update_visible_tiles_was_called", | 232 "last_frame_number_update_visible_tiles_was_called", |
226 last_frame_number_update_visible_tiles_was_called_); | 233 last_frame_number_update_visible_tiles_was_called_); |
227 | 234 |
228 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); | 235 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); |
229 minor_state->SetInteger("consecutive_checkerboard_animations", | 236 minor_state->SetInteger("consecutive_checkerboard_animations", |
230 consecutive_checkerboard_animations_); | 237 consecutive_checkerboard_animations_); |
231 minor_state->SetInteger("max_pending_swaps_", max_pending_swaps_); | 238 minor_state->SetInteger("max_pending_swaps_", max_pending_swaps_); |
232 minor_state->SetInteger("pending_swaps_", pending_swaps_); | 239 minor_state->SetInteger("pending_swaps_", pending_swaps_); |
233 minor_state->SetBoolean("needs_redraw", needs_redraw_); | 240 minor_state->SetBoolean("needs_redraw", needs_redraw_); |
| 241 minor_state->SetBoolean("needs_animate_", needs_animate_); |
234 minor_state->SetBoolean("needs_manage_tiles", needs_manage_tiles_); | 242 minor_state->SetBoolean("needs_manage_tiles", needs_manage_tiles_); |
235 minor_state->SetBoolean("swap_used_incomplete_tile", | 243 minor_state->SetBoolean("swap_used_incomplete_tile", |
236 swap_used_incomplete_tile_); | 244 swap_used_incomplete_tile_); |
237 minor_state->SetBoolean("needs_commit", needs_commit_); | 245 minor_state->SetBoolean("needs_commit", needs_commit_); |
238 minor_state->SetBoolean("visible", visible_); | 246 minor_state->SetBoolean("visible", visible_); |
239 minor_state->SetBoolean("can_start", can_start_); | 247 minor_state->SetBoolean("can_start", can_start_); |
240 minor_state->SetBoolean("can_draw", can_draw_); | 248 minor_state->SetBoolean("can_draw", can_draw_); |
241 minor_state->SetBoolean("has_pending_tree", has_pending_tree_); | 249 minor_state->SetBoolean("has_pending_tree", has_pending_tree_); |
242 minor_state->SetBoolean("pending_tree_is_ready_for_activation", | 250 minor_state->SetBoolean("pending_tree_is_ready_for_activation", |
243 pending_tree_is_ready_for_activation_); | 251 pending_tree_is_ready_for_activation_); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 428 |
421 // If the last swap drew with checkerboard or missing tiles, we should | 429 // If the last swap drew with checkerboard or missing tiles, we should |
422 // poll for any new visible tiles so we can be notified to draw again | 430 // poll for any new visible tiles so we can be notified to draw again |
423 // when there are. | 431 // when there are. |
424 if (swap_used_incomplete_tile_) | 432 if (swap_used_incomplete_tile_) |
425 return true; | 433 return true; |
426 | 434 |
427 return false; | 435 return false; |
428 } | 436 } |
429 | 437 |
| 438 bool SchedulerStateMachine::ShouldAnimate() const { |
| 439 if (!can_draw_) |
| 440 return false; |
| 441 |
| 442 if (last_frame_number_animate_performed_ == current_frame_number_) |
| 443 return false; |
| 444 |
| 445 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING && |
| 446 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) |
| 447 return false; |
| 448 |
| 449 return needs_redraw_ || needs_animate_; |
| 450 } |
| 451 |
430 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { | 452 bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { |
431 if (!needs_commit_) | 453 if (!needs_commit_) |
432 return false; | 454 return false; |
433 | 455 |
434 // Only send BeginMainFrame when there isn't another commit pending already. | 456 // Only send BeginMainFrame when there isn't another commit pending already. |
435 if (commit_state_ != COMMIT_STATE_IDLE) | 457 if (commit_state_ != COMMIT_STATE_IDLE) |
436 return false; | 458 return false; |
437 | 459 |
438 // Don't send BeginMainFrame early if we are prioritizing the active tree | 460 // Don't send BeginMainFrame early if we are prioritizing the active tree |
439 // because of smoothness_takes_priority. | 461 // because of smoothness_takes_priority. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 return needs_manage_tiles_; | 546 return needs_manage_tiles_; |
525 } | 547 } |
526 | 548 |
527 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const { | 549 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const { |
528 if (ShouldUpdateVisibleTiles()) | 550 if (ShouldUpdateVisibleTiles()) |
529 return ACTION_UPDATE_VISIBLE_TILES; | 551 return ACTION_UPDATE_VISIBLE_TILES; |
530 if (ShouldActivatePendingTree()) | 552 if (ShouldActivatePendingTree()) |
531 return ACTION_ACTIVATE_PENDING_TREE; | 553 return ACTION_ACTIVATE_PENDING_TREE; |
532 if (ShouldCommit()) | 554 if (ShouldCommit()) |
533 return ACTION_COMMIT; | 555 return ACTION_COMMIT; |
| 556 if (ShouldAnimate()) |
| 557 return ACTION_ANIMATE; |
534 if (ShouldDraw()) { | 558 if (ShouldDraw()) { |
535 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) | 559 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) |
536 return ACTION_DRAW_AND_READBACK; | 560 return ACTION_DRAW_AND_READBACK; |
537 else if (PendingDrawsShouldBeAborted()) | 561 else if (PendingDrawsShouldBeAborted()) |
538 return ACTION_DRAW_AND_SWAP_ABORT; | 562 return ACTION_DRAW_AND_SWAP_ABORT; |
539 else if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) | 563 else if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
540 return ACTION_DRAW_AND_SWAP_FORCED; | 564 return ACTION_DRAW_AND_SWAP_FORCED; |
541 else | 565 else |
542 return ACTION_DRAW_AND_SWAP_IF_POSSIBLE; | 566 return ACTION_DRAW_AND_SWAP_IF_POSSIBLE; |
543 } | 567 } |
(...skipping 20 matching lines...) Expand all Loading... |
564 | 588 |
565 case ACTION_UPDATE_VISIBLE_TILES: | 589 case ACTION_UPDATE_VISIBLE_TILES: |
566 last_frame_number_update_visible_tiles_was_called_ = | 590 last_frame_number_update_visible_tiles_was_called_ = |
567 current_frame_number_; | 591 current_frame_number_; |
568 return; | 592 return; |
569 | 593 |
570 case ACTION_ACTIVATE_PENDING_TREE: | 594 case ACTION_ACTIVATE_PENDING_TREE: |
571 UpdateStateOnActivation(); | 595 UpdateStateOnActivation(); |
572 return; | 596 return; |
573 | 597 |
| 598 case ACTION_ANIMATE: |
| 599 last_frame_number_animate_performed_ = current_frame_number_; |
| 600 needs_animate_ = false; |
| 601 // TODO(skyostil): Instead of assuming this, require the client to tell |
| 602 // us. |
| 603 SetNeedsRedraw(); |
| 604 return; |
| 605 |
574 case ACTION_SEND_BEGIN_MAIN_FRAME: | 606 case ACTION_SEND_BEGIN_MAIN_FRAME: |
575 DCHECK(!has_pending_tree_ || | 607 DCHECK(!has_pending_tree_ || |
576 settings_.main_frame_before_activation_enabled); | 608 settings_.main_frame_before_activation_enabled); |
577 DCHECK(!active_tree_needs_first_draw_ || | 609 DCHECK(!active_tree_needs_first_draw_ || |
578 settings_.main_frame_before_draw_enabled); | 610 settings_.main_frame_before_draw_enabled); |
579 DCHECK(visible_ || | 611 DCHECK(visible_ || |
580 readback_state_ == READBACK_STATE_NEEDS_BEGIN_MAIN_FRAME); | 612 readback_state_ == READBACK_STATE_NEEDS_BEGIN_MAIN_FRAME); |
581 commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_SENT; | 613 commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_SENT; |
582 needs_commit_ = false; | 614 needs_commit_ = false; |
583 if (readback_state_ == READBACK_STATE_NEEDS_BEGIN_MAIN_FRAME) | 615 if (readback_state_ == READBACK_STATE_NEEDS_BEGIN_MAIN_FRAME) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 skip_next_begin_main_frame_to_reduce_latency_ = true; | 808 skip_next_begin_main_frame_to_reduce_latency_ = true; |
777 } | 809 } |
778 | 810 |
779 bool SchedulerStateMachine::BeginFrameNeeded() const { | 811 bool SchedulerStateMachine::BeginFrameNeeded() const { |
780 // Proactive BeginFrames are bad for the synchronous compositor because we | 812 // Proactive BeginFrames are bad for the synchronous compositor because we |
781 // have to draw when we get the BeginFrame and could end up drawing many | 813 // have to draw when we get the BeginFrame and could end up drawing many |
782 // duplicate frames if our new frame isn't ready in time. | 814 // duplicate frames if our new frame isn't ready in time. |
783 // To poll for state with the synchronous compositor without having to draw, | 815 // To poll for state with the synchronous compositor without having to draw, |
784 // we rely on ShouldPollForAnticipatedDrawTriggers instead. | 816 // we rely on ShouldPollForAnticipatedDrawTriggers instead. |
785 if (!SupportsProactiveBeginFrame()) | 817 if (!SupportsProactiveBeginFrame()) |
786 return BeginFrameNeededToDraw(); | 818 return BeginFrameNeededToAnimateOrDraw(); |
787 | 819 |
788 return BeginFrameNeededToDraw() || ProactiveBeginFrameWanted(); | 820 return BeginFrameNeededToAnimateOrDraw() || ProactiveBeginFrameWanted(); |
789 } | 821 } |
790 | 822 |
791 bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { | 823 bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
792 // ShouldPollForAnticipatedDrawTriggers is what we use in place of | 824 // ShouldPollForAnticipatedDrawTriggers is what we use in place of |
793 // ProactiveBeginFrameWanted when we are using the synchronous | 825 // ProactiveBeginFrameWanted when we are using the synchronous |
794 // compositor. | 826 // compositor. |
795 if (!SupportsProactiveBeginFrame()) { | 827 if (!SupportsProactiveBeginFrame()) { |
796 return !BeginFrameNeededToDraw() && ProactiveBeginFrameWanted(); | 828 return !BeginFrameNeededToAnimateOrDraw() && ProactiveBeginFrameWanted(); |
797 } | 829 } |
798 | 830 |
799 // Non synchronous compositors should rely on | 831 // Non synchronous compositors should rely on |
800 // ProactiveBeginFrameWanted to poll for state instead. | 832 // ProactiveBeginFrameWanted to poll for state instead. |
801 return false; | 833 return false; |
802 } | 834 } |
803 | 835 |
804 // Note: If SupportsProactiveBeginFrame is false, the scheduler should poll | 836 // Note: If SupportsProactiveBeginFrame is false, the scheduler should poll |
805 // for changes in it's draw state so it can request a BeginFrame when it's | 837 // for changes in it's draw state so it can request a BeginFrame when it's |
806 // actually ready. | 838 // actually ready. |
807 bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { | 839 bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { |
808 // It is undesirable to proactively request BeginFrames if we are | 840 // It is undesirable to proactively request BeginFrames if we are |
809 // using a synchronous compositor because we *must* draw for every | 841 // using a synchronous compositor because we *must* draw for every |
810 // BeginFrame, which could cause duplicate draws. | 842 // BeginFrame, which could cause duplicate draws. |
811 return !settings_.using_synchronous_renderer_compositor; | 843 return !settings_.using_synchronous_renderer_compositor; |
812 } | 844 } |
813 | 845 |
814 // These are the cases where we definitely (or almost definitely) have a | 846 // These are the cases where we definitely (or almost definitely) have a |
815 // new frame to draw and can draw. | 847 // new frame to animate and/or draw and can draw. |
816 bool SchedulerStateMachine::BeginFrameNeededToDraw() const { | 848 bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
817 // The output surface is the provider of BeginImplFrames, so we are not going | 849 // The output surface is the provider of BeginImplFrames, so we are not going |
818 // to get them even if we ask for them. | 850 // to get them even if we ask for them. |
819 if (!HasInitializedOutputSurface()) | 851 if (!HasInitializedOutputSurface()) |
820 return false; | 852 return false; |
821 | 853 |
822 // If we can't draw, don't tick until we are notified that we can draw again. | 854 // If we can't draw, don't tick until we are notified that we can draw again. |
823 if (!can_draw_) | 855 if (!can_draw_) |
824 return false; | 856 return false; |
825 | 857 |
826 // The forced draw respects our normal draw scheduling, so we need to | 858 // The forced draw respects our normal draw scheduling, so we need to |
827 // request a BeginImplFrame for it. | 859 // request a BeginImplFrame for it. |
828 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) | 860 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
829 return true; | 861 return true; |
830 | 862 |
831 // There's no need to produce frames if we are not visible. | 863 // There's no need to produce frames if we are not visible. |
832 if (!visible_) | 864 if (!visible_) |
833 return false; | 865 return false; |
834 | 866 |
835 // We need to draw a more complete frame than we did the last BeginImplFrame, | 867 // We need to draw a more complete frame than we did the last BeginImplFrame, |
836 // so request another BeginImplFrame in anticipation that we will have | 868 // so request another BeginImplFrame in anticipation that we will have |
837 // additional visible tiles. | 869 // additional visible tiles. |
838 if (swap_used_incomplete_tile_) | 870 if (swap_used_incomplete_tile_) |
839 return true; | 871 return true; |
840 | 872 |
| 873 if (needs_animate_) |
| 874 return true; |
| 875 |
841 return needs_redraw_; | 876 return needs_redraw_; |
842 } | 877 } |
843 | 878 |
844 // These are cases where we are very likely to draw soon, but might not | 879 // These are cases where we are very likely to draw soon, but might not |
845 // actually have a new frame to draw when we receive the next BeginImplFrame. | 880 // actually have a new frame to draw when we receive the next BeginImplFrame. |
846 // Proactively requesting the BeginImplFrame helps hide the round trip latency | 881 // Proactively requesting the BeginImplFrame helps hide the round trip latency |
847 // of the SetNeedsBeginFrame request that has to go to the Browser. | 882 // of the SetNeedsBeginFrame request that has to go to the Browser. |
848 bool SchedulerStateMachine::ProactiveBeginFrameWanted() const { | 883 bool SchedulerStateMachine::ProactiveBeginFrameWanted() const { |
849 // The output surface is the provider of BeginImplFrames, | 884 // The output surface is the provider of BeginImplFrames, |
850 // so we are not going to get them even if we ask for them. | 885 // so we are not going to get them even if we ask for them. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 void SchedulerStateMachine::DidLeavePollForAnticipatedDrawTriggers() { | 1035 void SchedulerStateMachine::DidLeavePollForAnticipatedDrawTriggers() { |
1001 inside_poll_for_anticipated_draw_triggers_ = false; | 1036 inside_poll_for_anticipated_draw_triggers_ = false; |
1002 } | 1037 } |
1003 | 1038 |
1004 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } | 1039 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } |
1005 | 1040 |
1006 void SchedulerStateMachine::SetCanDraw(bool can_draw) { can_draw_ = can_draw; } | 1041 void SchedulerStateMachine::SetCanDraw(bool can_draw) { can_draw_ = can_draw; } |
1007 | 1042 |
1008 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } | 1043 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } |
1009 | 1044 |
| 1045 void SchedulerStateMachine::SetNeedsAnimate() { |
| 1046 needs_animate_ = true; |
| 1047 } |
| 1048 |
1010 void SchedulerStateMachine::SetNeedsManageTiles() { | 1049 void SchedulerStateMachine::SetNeedsManageTiles() { |
1011 if (!needs_manage_tiles_) { | 1050 if (!needs_manage_tiles_) { |
1012 TRACE_EVENT0("cc", | 1051 TRACE_EVENT0("cc", |
1013 "SchedulerStateMachine::SetNeedsManageTiles"); | 1052 "SchedulerStateMachine::SetNeedsManageTiles"); |
1014 needs_manage_tiles_ = true; | 1053 needs_manage_tiles_ = true; |
1015 } | 1054 } |
1016 } | 1055 } |
1017 | 1056 |
1018 void SchedulerStateMachine::SetMaxSwapsPending(int max) { | 1057 void SchedulerStateMachine::SetMaxSwapsPending(int max) { |
1019 max_pending_swaps_ = max; | 1058 max_pending_swaps_ = max; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 case OUTPUT_SURFACE_ACTIVE: | 1226 case OUTPUT_SURFACE_ACTIVE: |
1188 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1227 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
1189 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1228 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
1190 return true; | 1229 return true; |
1191 } | 1230 } |
1192 NOTREACHED(); | 1231 NOTREACHED(); |
1193 return false; | 1232 return false; |
1194 } | 1233 } |
1195 | 1234 |
1196 } // namespace cc | 1235 } // namespace cc |
OLD | NEW |