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