Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: cc/scheduler/scheduler_state_machine.cc

Issue 246753008: cc: Unify use of DidSwapBuffers() and did_request_swap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_animate_performed_(-1),
26 last_frame_number_swap_performed_(-1), 26 last_frame_number_swap_performed_(-1),
27 last_frame_number_swap_request_sent_(-1),
27 last_frame_number_begin_main_frame_sent_(-1), 28 last_frame_number_begin_main_frame_sent_(-1),
29 last_frame_number_draw_request_sent_(-1),
28 last_frame_number_update_visible_tiles_was_called_(-1), 30 last_frame_number_update_visible_tiles_was_called_(-1),
29 manage_tiles_funnel_(0), 31 manage_tiles_funnel_(0),
30 consecutive_checkerboard_animations_(0), 32 consecutive_checkerboard_animations_(0),
31 max_pending_swaps_(1), 33 max_pending_swaps_(1),
32 pending_swaps_(0), 34 pending_swaps_(0),
33 needs_redraw_(false), 35 needs_redraw_(false),
34 needs_animate_(false), 36 needs_animate_(false),
35 needs_manage_tiles_(false), 37 needs_manage_tiles_(false),
36 swap_used_incomplete_tile_(false), 38 swap_used_incomplete_tile_(false),
37 needs_commit_(false), 39 needs_commit_(false),
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 state->Set("major_timestamps_in_ms", timestamps_state.release()); 219 state->Set("major_timestamps_in_ms", timestamps_state.release());
218 220
219 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue); 221 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue);
220 minor_state->SetInteger("commit_count", commit_count_); 222 minor_state->SetInteger("commit_count", commit_count_);
221 minor_state->SetInteger("current_frame_number", current_frame_number_); 223 minor_state->SetInteger("current_frame_number", current_frame_number_);
222 224
223 minor_state->SetInteger("last_frame_number_animate_performed", 225 minor_state->SetInteger("last_frame_number_animate_performed",
224 last_frame_number_animate_performed_); 226 last_frame_number_animate_performed_);
225 minor_state->SetInteger("last_frame_number_swap_performed", 227 minor_state->SetInteger("last_frame_number_swap_performed",
226 last_frame_number_swap_performed_); 228 last_frame_number_swap_performed_);
229 minor_state->SetInteger("last_frame_number_swap_request_sent",
230 last_frame_number_swap_request_sent_);
227 minor_state->SetInteger( 231 minor_state->SetInteger(
228 "last_frame_number_begin_main_frame_sent", 232 "last_frame_number_begin_main_frame_sent",
229 last_frame_number_begin_main_frame_sent_); 233 last_frame_number_begin_main_frame_sent_);
230 minor_state->SetInteger( 234 minor_state->SetInteger(
235 "last_frame_number_draw_request_sent",
236 last_frame_number_draw_request_sent_);
237 minor_state->SetInteger(
231 "last_frame_number_update_visible_tiles_was_called", 238 "last_frame_number_update_visible_tiles_was_called",
232 last_frame_number_update_visible_tiles_was_called_); 239 last_frame_number_update_visible_tiles_was_called_);
233 240
234 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); 241 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_);
235 minor_state->SetInteger("consecutive_checkerboard_animations", 242 minor_state->SetInteger("consecutive_checkerboard_animations",
236 consecutive_checkerboard_animations_); 243 consecutive_checkerboard_animations_);
237 minor_state->SetInteger("max_pending_swaps_", max_pending_swaps_); 244 minor_state->SetInteger("max_pending_swaps_", max_pending_swaps_);
238 minor_state->SetInteger("pending_swaps_", pending_swaps_); 245 minor_state->SetInteger("pending_swaps_", pending_swaps_);
239 minor_state->SetBoolean("needs_redraw", needs_redraw_); 246 minor_state->SetBoolean("needs_redraw", needs_redraw_);
240 minor_state->SetBoolean("needs_animate_", needs_animate_); 247 minor_state->SetBoolean("needs_animate_", needs_animate_);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 292
286 bool SchedulerStateMachine::HasUpdatedVisibleTilesThisFrame() const { 293 bool SchedulerStateMachine::HasUpdatedVisibleTilesThisFrame() const {
287 return current_frame_number_ == 294 return current_frame_number_ ==
288 last_frame_number_update_visible_tiles_was_called_; 295 last_frame_number_update_visible_tiles_was_called_;
289 } 296 }
290 297
291 bool SchedulerStateMachine::HasSwappedThisFrame() const { 298 bool SchedulerStateMachine::HasSwappedThisFrame() const {
292 return current_frame_number_ == last_frame_number_swap_performed_; 299 return current_frame_number_ == last_frame_number_swap_performed_;
293 } 300 }
294 301
302 bool SchedulerStateMachine::HasRequestedSwapThisFrame() const {
303 return current_frame_number_ == last_frame_number_swap_request_sent_;
304 }
305
306 bool SchedulerStateMachine::HasRequestedDrawThisFrame() const {
307 return current_frame_number_ == last_frame_number_draw_request_sent_;
308 }
309
295 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { 310 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
296 // These are all the cases where we normally cannot or do not want to draw 311 // These are all the cases where we normally cannot or do not want to draw
297 // but, if needs_redraw_ is true and we do not draw to make forward progress, 312 // but, if needs_redraw_ is true and we do not draw to make forward progress,
298 // we might deadlock with the main thread. 313 // we might deadlock with the main thread.
299 // This should be a superset of PendingActivationsShouldBeForced() since 314 // This should be a superset of PendingActivationsShouldBeForced() since
300 // activation of the pending tree is blocked by drawing of the active tree and 315 // activation of the pending tree is blocked by drawing of the active tree and
301 // the main thread might be blocked on activation of the most recent commit. 316 // the main thread might be blocked on activation of the most recent commit.
302 if (PendingActivationsShouldBeForced()) 317 if (PendingActivationsShouldBeForced())
303 return true; 318 return true;
304 319
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return true; 378 return true;
364 379
365 // If we need to abort draws, we should do so ASAP since the draw could 380 // If we need to abort draws, we should do so ASAP since the draw could
366 // be blocking other important actions (like output surface initialization), 381 // be blocking other important actions (like output surface initialization),
367 // from occuring. If we are waiting for the first draw, then perfom the 382 // from occuring. If we are waiting for the first draw, then perfom the
368 // aborted draw to keep things moving. If we are not waiting for the first 383 // aborted draw to keep things moving. If we are not waiting for the first
369 // draw however, we don't want to abort for no reason. 384 // draw however, we don't want to abort for no reason.
370 if (PendingDrawsShouldBeAborted()) 385 if (PendingDrawsShouldBeAborted())
371 return active_tree_needs_first_draw_; 386 return active_tree_needs_first_draw_;
372 387
373 // After this line, we only want to swap once per frame. 388 // After this line, we only want to send swap request once per frame.
Sami 2014/05/08 14:18:11 nit: "send a swap request"
simonhong 2014/05/08 14:50:14 Done.
374 if (HasSwappedThisFrame()) 389 if (HasRequestedSwapThisFrame())
375 return false; 390 return false;
376 391
377 // Do not queue too many swaps. 392 // Do not queue too many swaps.
378 if (pending_swaps_ >= max_pending_swaps_) 393 if (pending_swaps_ >= max_pending_swaps_)
379 return false; 394 return false;
380 395
381 // Except for the cases above, do not draw outside of the BeginImplFrame 396 // Except for the cases above, do not draw outside of the BeginImplFrame
382 // deadline. 397 // deadline.
383 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) 398 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
384 return false; 399 return false;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; 799 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE;
785 } 800 }
786 801
787 if (!has_pending_tree_ && 802 if (!has_pending_tree_ &&
788 commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) { 803 commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) {
789 commit_state_ = COMMIT_STATE_IDLE; 804 commit_state_ = COMMIT_STATE_IDLE;
790 } 805 }
791 806
792 needs_redraw_ = false; 807 needs_redraw_ = false;
793 active_tree_needs_first_draw_ = false; 808 active_tree_needs_first_draw_ = false;
809 last_frame_number_draw_request_sent_ = current_frame_number_;
794 810
795 if (did_request_swap) 811 if (did_request_swap)
796 last_frame_number_swap_performed_ = current_frame_number_; 812 last_frame_number_swap_request_sent_ = current_frame_number_;
797 } 813 }
798 814
799 void SchedulerStateMachine::UpdateStateOnManageTiles() { 815 void SchedulerStateMachine::UpdateStateOnManageTiles() {
800 needs_manage_tiles_ = false; 816 needs_manage_tiles_ = false;
801 } 817 }
802 818
803 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { 819 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() {
804 skip_next_begin_main_frame_to_reduce_latency_ = true; 820 skip_next_begin_main_frame_to_reduce_latency_ = true;
805 } 821 }
806 822
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 // If the pending tree activates quickly, we'll want a BeginImplFrame soon 910 // If the pending tree activates quickly, we'll want a BeginImplFrame soon
895 // to draw the new active tree. 911 // to draw the new active tree.
896 if (has_pending_tree_) 912 if (has_pending_tree_)
897 return true; 913 return true;
898 914
899 // Changing priorities may allow us to activate (given the new priorities), 915 // Changing priorities may allow us to activate (given the new priorities),
900 // which may result in a new frame. 916 // which may result in a new frame.
901 if (needs_manage_tiles_) 917 if (needs_manage_tiles_)
902 return true; 918 return true;
903 919
904 // If we just swapped, it's likely that we are going to produce another 920 // If we just sent draw request, it's likely that we are going to produce
Sami 2014/05/08 14:18:11 nit: "sent a draw request" or "requested a draw"
simonhong 2014/05/08 14:50:14 Done.
905 // frame soon. This helps avoid negative glitches in our 921 // another frame soon. This helps avoid negative glitches in our
906 // SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame 922 // SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame
907 // provider and get sampled at an inopportune time, delaying the next 923 // provider and get sampled at an inopportune time, delaying the next
908 // BeginImplFrame. 924 // BeginImplFrame.
909 if (last_frame_number_swap_performed_ == current_frame_number_) 925 if (HasRequestedDrawThisFrame())
910 return true; 926 return true;
911 927
912 return false; 928 return false;
913 } 929 }
914 930
915 void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) { 931 void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) {
916 AdvanceCurrentFrameNumber(); 932 AdvanceCurrentFrameNumber();
917 begin_impl_frame_args_ = args; 933 begin_impl_frame_args_ = args;
918 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE) << *AsValue(); 934 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE) << *AsValue();
919 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; 935 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 996 }
981 997
982 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const { 998 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
983 // If a commit is pending before the previous commit has been drawn, we 999 // If a commit is pending before the previous commit has been drawn, we
984 // are definitely in a high latency mode. 1000 // are definitely in a high latency mode.
985 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_)) 1001 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_))
986 return true; 1002 return true;
987 1003
988 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main 1004 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main
989 // thread is in a low latency mode. 1005 // thread is in a low latency mode.
990 if (last_frame_number_begin_main_frame_sent_ == current_frame_number_ && 1006 if (HasSentBeginMainFrameThisFrame() &&
991 (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING || 1007 (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING ||
992 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)) 1008 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME))
993 return false; 1009 return false;
994 1010
995 // If there's a commit in progress it must either be from the previous frame 1011 // If there's a commit in progress it must either be from the previous frame
996 // or it started after the impl thread's deadline. In either case the main 1012 // or it started after the impl thread's deadline. In either case the main
997 // thread is in high latency mode. 1013 // thread is in high latency mode.
998 if (commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 1014 if (CommitPending())
999 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED ||
1000 commit_state_ == COMMIT_STATE_READY_TO_COMMIT)
1001 return true; 1015 return true;
1002 1016
1003 // Similarly, if there's a pending tree the main thread is in high latency 1017 // Similarly, if there's a pending tree the main thread is in high latency
1004 // mode, because either 1018 // mode, because either
1005 // it's from the previous frame 1019 // it's from the previous frame
1006 // or 1020 // or
1007 // we're currently drawing the active tree and the pending tree will thus 1021 // we're currently drawing the active tree and the pending tree will thus
1008 // only be drawn in the next frame. 1022 // only be drawn in the next frame.
1009 if (has_pending_tree_) 1023 if (has_pending_tree_)
1010 return true; 1024 return true;
1011 1025
1012 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) { 1026 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) {
1013 // Even if there's a new active tree to draw at the deadline or we've just 1027 // Even if there's a new active tree to draw at the deadline or we've just
1014 // drawn it, it may have been triggered by a previous BeginImplFrame, in 1028 // swapped it, it may have been triggered by a previous BeginImplFrame, in
1015 // which case the main thread is in a high latency mode. 1029 // which case the main thread is in a high latency mode.
1016 return (active_tree_needs_first_draw_ || 1030 return (active_tree_needs_first_draw_ || HasSwappedThisFrame()) &&
Sami 2014/05/08 14:18:11 Should this be HasSwappedThisFrame() or HasSentSwa
simonhong 2014/05/08 14:50:14 As brian said, we should check whether swap is per
1017 last_frame_number_swap_performed_ == current_frame_number_) && 1031 !HasSentBeginMainFrameThisFrame();
1018 last_frame_number_begin_main_frame_sent_ != current_frame_number_;
1019 } 1032 }
1020 1033
1021 // If the active tree needs its first draw in any other state, we know the 1034 // If the active tree needs its first draw in any other state, we know the
1022 // main thread is in a high latency mode. 1035 // main thread is in a high latency mode.
1023 return active_tree_needs_first_draw_; 1036 return active_tree_needs_first_draw_;
1024 } 1037 }
1025 1038
1026 void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() { 1039 void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() {
1027 AdvanceCurrentFrameNumber(); 1040 AdvanceCurrentFrameNumber();
1028 inside_poll_for_anticipated_draw_triggers_ = true; 1041 inside_poll_for_anticipated_draw_triggers_ = true;
(...skipping 21 matching lines...) Expand all
1050 } 1063 }
1051 } 1064 }
1052 1065
1053 void SchedulerStateMachine::SetMaxSwapsPending(int max) { 1066 void SchedulerStateMachine::SetMaxSwapsPending(int max) {
1054 max_pending_swaps_ = max; 1067 max_pending_swaps_ = max;
1055 } 1068 }
1056 1069
1057 void SchedulerStateMachine::DidSwapBuffers() { 1070 void SchedulerStateMachine::DidSwapBuffers() {
1058 pending_swaps_++; 1071 pending_swaps_++;
1059 DCHECK_LE(pending_swaps_, max_pending_swaps_); 1072 DCHECK_LE(pending_swaps_, max_pending_swaps_);
1073
1074 last_frame_number_swap_performed_ = current_frame_number_;
1060 } 1075 }
1061 1076
1062 void SchedulerStateMachine::SetSwapUsedIncompleteTile( 1077 void SchedulerStateMachine::SetSwapUsedIncompleteTile(
1063 bool used_incomplete_tile) { 1078 bool used_incomplete_tile) {
1064 swap_used_incomplete_tile_ = used_incomplete_tile; 1079 swap_used_incomplete_tile_ = used_incomplete_tile;
1065 } 1080 }
1066 1081
1067 void SchedulerStateMachine::DidSwapBuffersComplete() { 1082 void SchedulerStateMachine::DidSwapBuffersComplete() {
1068 DCHECK_GT(pending_swaps_, 0); 1083 DCHECK_GT(pending_swaps_, 0);
1069 pending_swaps_--; 1084 pending_swaps_--;
1070 } 1085 }
1071 1086
1072 void SchedulerStateMachine::SetSmoothnessTakesPriority( 1087 void SchedulerStateMachine::SetSmoothnessTakesPriority(
1073 bool smoothness_takes_priority) { 1088 bool smoothness_takes_priority) {
1074 smoothness_takes_priority_ = smoothness_takes_priority; 1089 smoothness_takes_priority_ = smoothness_takes_priority;
1075 } 1090 }
1076 1091
1077 void SchedulerStateMachine::DidDrawIfPossibleCompleted( 1092 void SchedulerStateMachine::DidDrawIfPossibleCompleted(DrawResult result) {
1078 DrawSwapReadbackResult::DrawResult result) {
1079 switch (result) { 1093 switch (result) {
1080 case DrawSwapReadbackResult::INVALID_RESULT: 1094 case INVALID_RESULT:
1081 NOTREACHED() << "Uninitialized DrawSwapReadbackResult."; 1095 NOTREACHED() << "Uninitialized DrawResult.";
1082 break; 1096 break;
1083 case DrawSwapReadbackResult::DRAW_ABORTED_CANT_DRAW: 1097 case DRAW_ABORTED_CANT_DRAW:
1084 case DrawSwapReadbackResult::DRAW_ABORTED_CANT_READBACK: 1098 case DRAW_ABORTED_CANT_READBACK:
1085 case DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST: 1099 case DRAW_ABORTED_CONTEXT_LOST:
1086 NOTREACHED() << "Invalid return value from DrawAndSwapIfPossible:" 1100 NOTREACHED() << "Invalid return value from DrawAndSwapIfPossible:"
1087 << result; 1101 << result;
1088 break; 1102 break;
1089 case DrawSwapReadbackResult::DRAW_SUCCESS: 1103 case DRAW_SUCCESS:
1090 consecutive_checkerboard_animations_ = 0; 1104 consecutive_checkerboard_animations_ = 0;
1091 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; 1105 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE;
1092 break; 1106 break;
1093 case DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS: 1107 case DRAW_ABORTED_CHECKERBOARD_ANIMATIONS:
1094 needs_redraw_ = true; 1108 needs_redraw_ = true;
1095 1109
1096 // If we're already in the middle of a redraw, we don't need to 1110 // If we're already in the middle of a redraw, we don't need to
1097 // restart it. 1111 // restart it.
1098 if (forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE) 1112 if (forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE)
1099 return; 1113 return;
1100 1114
1101 needs_commit_ = true; 1115 needs_commit_ = true;
1102 consecutive_checkerboard_animations_++; 1116 consecutive_checkerboard_animations_++;
1103 if (settings_.timeout_and_draw_when_animation_checkerboards && 1117 if (settings_.timeout_and_draw_when_animation_checkerboards &&
1104 consecutive_checkerboard_animations_ >= 1118 consecutive_checkerboard_animations_ >=
1105 settings_.maximum_number_of_failed_draws_before_draw_is_forced_) { 1119 settings_.maximum_number_of_failed_draws_before_draw_is_forced_) {
1106 consecutive_checkerboard_animations_ = 0; 1120 consecutive_checkerboard_animations_ = 0;
1107 // We need to force a draw, but it doesn't make sense to do this until 1121 // We need to force a draw, but it doesn't make sense to do this until
1108 // we've committed and have new textures. 1122 // we've committed and have new textures.
1109 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT; 1123 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT;
1110 } 1124 }
1111 break; 1125 break;
1112 case DrawSwapReadbackResult::DRAW_ABORTED_MISSING_HIGH_RES_CONTENT: 1126 case DRAW_ABORTED_MISSING_HIGH_RES_CONTENT:
1113 // It's not clear whether this missing content is because of missing 1127 // It's not clear whether this missing content is because of missing
1114 // pictures (which requires a commit) or because of memory pressure 1128 // pictures (which requires a commit) or because of memory pressure
1115 // removing textures (which might not). To be safe, request a commit 1129 // removing textures (which might not). To be safe, request a commit
1116 // anyway. 1130 // anyway.
1117 needs_commit_ = true; 1131 needs_commit_ = true;
1118 break; 1132 break;
1119 } 1133 }
1120 } 1134 }
1121 1135
1122 void SchedulerStateMachine::SetNeedsCommit() { needs_commit_ = true; } 1136 void SchedulerStateMachine::SetNeedsCommit() { needs_commit_ = true; }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 case OUTPUT_SURFACE_ACTIVE: 1236 case OUTPUT_SURFACE_ACTIVE:
1223 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: 1237 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT:
1224 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: 1238 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION:
1225 return true; 1239 return true;
1226 } 1240 }
1227 NOTREACHED(); 1241 NOTREACHED();
1228 return false; 1242 return false;
1229 } 1243 }
1230 1244
1231 } // namespace cc 1245 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698