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

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

Issue 1020993002: cc: Do not pass BeginFrameArgs to state machine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return "ACTION_PREPARE_TILES"; 144 return "ACTION_PREPARE_TILES";
145 } 145 }
146 NOTREACHED(); 146 NOTREACHED();
147 return "???"; 147 return "???";
148 } 148 }
149 149
150 scoped_refptr<base::trace_event::ConvertableToTraceFormat> 150 scoped_refptr<base::trace_event::ConvertableToTraceFormat>
151 SchedulerStateMachine::AsValue() const { 151 SchedulerStateMachine::AsValue() const {
152 scoped_refptr<base::trace_event::TracedValue> state = 152 scoped_refptr<base::trace_event::TracedValue> state =
153 new base::trace_event::TracedValue(); 153 new base::trace_event::TracedValue();
154 AsValueInto(state.get(), gfx::FrameTime::Now()); 154 AsValueInto(state.get());
155 return state; 155 return state;
156 } 156 }
157 157
158 void SchedulerStateMachine::AsValueInto(base::trace_event::TracedValue* state, 158 void SchedulerStateMachine::AsValueInto(
159 base::TimeTicks now) const { 159 base::trace_event::TracedValue* state) const {
160 state->BeginDictionary("major_state"); 160 state->BeginDictionary("major_state");
161 state->SetString("next_action", ActionToString(NextAction())); 161 state->SetString("next_action", ActionToString(NextAction()));
162 state->SetString("begin_impl_frame_state", 162 state->SetString("begin_impl_frame_state",
163 BeginImplFrameStateToString(begin_impl_frame_state_)); 163 BeginImplFrameStateToString(begin_impl_frame_state_));
164 state->SetString("commit_state", CommitStateToString(commit_state_)); 164 state->SetString("commit_state", CommitStateToString(commit_state_));
165 state->SetString("output_surface_state_", 165 state->SetString("output_surface_state_",
166 OutputSurfaceStateToString(output_surface_state_)); 166 OutputSurfaceStateToString(output_surface_state_));
167 state->SetString("forced_redraw_state", 167 state->SetString("forced_redraw_state",
168 ForcedRedrawOnTimeoutStateToString(forced_redraw_state_)); 168 ForcedRedrawOnTimeoutStateToString(forced_redraw_state_));
169 state->EndDictionary(); 169 state->EndDictionary();
170 170
171 state->BeginDictionary("major_timestamps_in_ms");
172 state->SetDouble("0_interval",
173 begin_impl_frame_args_.interval.InMicroseconds() / 1000.0L);
174 state->SetDouble(
175 "1_now_to_deadline",
176 (begin_impl_frame_args_.deadline - now).InMicroseconds() / 1000.0L);
177 state->SetDouble(
178 "2_frame_time_to_now",
179 (now - begin_impl_frame_args_.frame_time).InMicroseconds() / 1000.0L);
180 state->SetDouble("3_frame_time_to_deadline",
181 (begin_impl_frame_args_.deadline -
182 begin_impl_frame_args_.frame_time).InMicroseconds() /
183 1000.0L);
184 state->SetDouble("4_now",
185 (now - base::TimeTicks()).InMicroseconds() / 1000.0L);
186 state->SetDouble(
187 "5_frame_time",
188 (begin_impl_frame_args_.frame_time - base::TimeTicks()).InMicroseconds() /
189 1000.0L);
190 state->SetDouble(
191 "6_deadline",
192 (begin_impl_frame_args_.deadline - base::TimeTicks()).InMicroseconds() /
193 1000.0L);
194 state->EndDictionary();
195
196 state->BeginDictionary("minor_state"); 171 state->BeginDictionary("minor_state");
197 state->SetInteger("commit_count", commit_count_); 172 state->SetInteger("commit_count", commit_count_);
198 state->SetInteger("current_frame_number", current_frame_number_); 173 state->SetInteger("current_frame_number", current_frame_number_);
199 174
200 state->SetInteger("last_frame_number_animate_performed", 175 state->SetInteger("last_frame_number_animate_performed",
201 last_frame_number_animate_performed_); 176 last_frame_number_animate_performed_);
202 state->SetInteger("last_frame_number_swap_performed", 177 state->SetInteger("last_frame_number_swap_performed",
203 last_frame_number_swap_performed_); 178 last_frame_number_swap_performed_);
204 state->SetInteger("last_frame_number_swap_requested", 179 state->SetInteger("last_frame_number_swap_requested",
205 last_frame_number_swap_requested_); 180 last_frame_number_swap_requested_);
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // another frame soon. This helps avoid negative glitches in our 789 // another frame soon. This helps avoid negative glitches in our
815 // SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame 790 // SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame
816 // provider and get sampled at an inopportune time, delaying the next 791 // provider and get sampled at an inopportune time, delaying the next
817 // BeginImplFrame. 792 // BeginImplFrame.
818 if (HasRequestedSwapThisFrame()) 793 if (HasRequestedSwapThisFrame())
819 return true; 794 return true;
820 795
821 return false; 796 return false;
822 } 797 }
823 798
824 void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) { 799 void SchedulerStateMachine::OnBeginImplFrame() {
825 AdvanceCurrentFrameNumber(); 800 AdvanceCurrentFrameNumber();
826 begin_impl_frame_args_ = args;
827 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE) 801 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE)
828 << AsValue()->ToString(); 802 << AsValue()->ToString();
829 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; 803 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING;
830 } 804 }
831 805
832 void SchedulerStateMachine::OnBeginImplFrameDeadlinePending() { 806 void SchedulerStateMachine::OnBeginImplFrameDeadlinePending() {
833 DCHECK_EQ(begin_impl_frame_state_, 807 DCHECK_EQ(begin_impl_frame_state_,
834 BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING) 808 BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING)
835 << AsValue()->ToString(); 809 << AsValue()->ToString();
836 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME; 810 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 static_cast<int>(begin_impl_frame_state_), 1097 static_cast<int>(begin_impl_frame_state_),
1124 static_cast<int>(commit_state_), 1098 static_cast<int>(commit_state_),
1125 has_pending_tree_ ? 'T' : 'F', 1099 has_pending_tree_ ? 'T' : 'F',
1126 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1100 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1127 active_tree_needs_first_draw_ ? 'T' : 'F', 1101 active_tree_needs_first_draw_ ? 'T' : 'F',
1128 max_pending_swaps_, 1102 max_pending_swaps_,
1129 pending_swaps_); 1103 pending_swaps_);
1130 } 1104 }
1131 1105
1132 } // namespace cc 1106 } // 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