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

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

Issue 822933004: cc: Trigger deadline immediately when commit is aborted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 // TODO(brianderson): This should take into account multiple commit sources. 846 // TODO(brianderson): This should take into account multiple commit sources.
847 847
848 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) 848 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)
849 return false; 849 return false;
850 850
851 // If we've lost the output surface, end the current BeginImplFrame ASAP 851 // If we've lost the output surface, end the current BeginImplFrame ASAP
852 // so we can start creating the next output surface. 852 // so we can start creating the next output surface.
853 if (output_surface_state_ == OUTPUT_SURFACE_LOST) 853 if (output_surface_state_ == OUTPUT_SURFACE_LOST)
854 return true; 854 return true;
855 855
856 // SwapAck throttle the deadline since we wont draw and swap anyway. 856 if (needs_redraw_) {
857 if (pending_swaps_ >= max_pending_swaps_) 857 // SwapAck throttle the deadline since we wont draw and swap anyway.
858 return false; 858 if (pending_swaps_ >= max_pending_swaps_)
brianderson 2015/01/09 23:54:22 Putting this inside the if(needs_redraw) I think w
sunnyps 2015/01/13 19:36:01 Done. The test I had to change in scheduler_state_
859 return false;
859 860
860 if (active_tree_needs_first_draw_) 861 if (active_tree_needs_first_draw_)
861 return true; 862 return true;
862 863
863 if (!needs_redraw_) 864 // Prioritize impl-thread draws in impl_latency_takes_priority_ mode.
864 return false; 865 if (impl_latency_takes_priority_)
866 return true;
867
868 // If we are on battery power and want to prioritize impl latency because
869 // we don't trust deadline tasks to execute at the right time.
870 if (impl_latency_takes_priority_on_battery_)
871 return true;
872 }
865 873
866 // This is used to prioritize impl-thread draws when the main thread isn't 874 // This is used to prioritize impl-thread draws when the main thread isn't
867 // producing anything, e.g., after an aborted commit. We also check that we 875 // producing anything, e.g., after an aborted commit. We also check that we
868 // don't have a pending tree -- otherwise we should give it a chance to 876 // don't have a pending tree -- otherwise we should give it a chance to
869 // activate. 877 // activate.
870 // TODO(skyostil): Revisit this when we have more accurate deadline estimates. 878 // TODO(skyostil): Revisit this when we have more accurate deadline estimates.
871 if (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_) 879 return (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_);
872 return true;
873
874 // Prioritize impl-thread draws in impl_latency_takes_priority_ mode.
875 if (impl_latency_takes_priority_)
876 return true;
877
878 // If we are on battery power and want to prioritize impl latency because
879 // we don't trust deadline tasks to execute at the right time.
880 if (impl_latency_takes_priority_on_battery_)
881 return true;
882
883 return false;
884 } 880 }
885 881
886 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const { 882 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
887 // If a commit is pending before the previous commit has been drawn, we 883 // If a commit is pending before the previous commit has been drawn, we
888 // are definitely in a high latency mode. 884 // are definitely in a high latency mode.
889 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_)) 885 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_))
890 return true; 886 return true;
891 887
892 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main 888 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main
893 // thread is in a low latency mode. 889 // thread is in a low latency mode.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 static_cast<int>(begin_impl_frame_state_), 1099 static_cast<int>(begin_impl_frame_state_),
1104 static_cast<int>(commit_state_), 1100 static_cast<int>(commit_state_),
1105 has_pending_tree_ ? 'T' : 'F', 1101 has_pending_tree_ ? 'T' : 'F',
1106 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1102 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1107 active_tree_needs_first_draw_ ? 'T' : 'F', 1103 active_tree_needs_first_draw_ ? 'T' : 'F',
1108 max_pending_swaps_, 1104 max_pending_swaps_,
1109 pending_swaps_); 1105 pending_swaps_);
1110 } 1106 }
1111 1107
1112 } // namespace cc 1108 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | cc/scheduler/scheduler_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698