| 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 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) | 16 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
| 16 : settings_(settings), | 17 : settings_(settings), |
| 17 output_surface_state_(OUTPUT_SURFACE_LOST), | 18 output_surface_state_(OUTPUT_SURFACE_LOST), |
| 18 begin_frame_state_(BEGIN_FRAME_STATE_IDLE), | 19 begin_frame_state_(BEGIN_FRAME_STATE_IDLE), |
| 19 commit_state_(COMMIT_STATE_IDLE), | 20 commit_state_(COMMIT_STATE_IDLE), |
| 20 texture_state_(LAYER_TEXTURE_STATE_UNLOCKED), | 21 texture_state_(LAYER_TEXTURE_STATE_UNLOCKED), |
| 21 forced_redraw_state_(FORCED_REDRAW_STATE_IDLE), | 22 forced_redraw_state_(FORCED_REDRAW_STATE_IDLE), |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 major_state->SetString("output_surface_state_", | 186 major_state->SetString("output_surface_state_", |
| 186 OutputSurfaceStateToString(output_surface_state_)); | 187 OutputSurfaceStateToString(output_surface_state_)); |
| 187 major_state->SetString( | 188 major_state->SetString( |
| 188 "forced_redraw_state", | 189 "forced_redraw_state", |
| 189 ForcedRedrawOnTimeoutStateToString(forced_redraw_state_)); | 190 ForcedRedrawOnTimeoutStateToString(forced_redraw_state_)); |
| 190 major_state->SetString("readback_state", | 191 major_state->SetString("readback_state", |
| 191 SynchronousReadbackStateToString(readback_state_)); | 192 SynchronousReadbackStateToString(readback_state_)); |
| 192 state->Set("major_state", major_state.release()); | 193 state->Set("major_state", major_state.release()); |
| 193 | 194 |
| 194 scoped_ptr<base::DictionaryValue> timestamps_state(new base::DictionaryValue); | 195 scoped_ptr<base::DictionaryValue> timestamps_state(new base::DictionaryValue); |
| 195 base::TimeTicks now = base::TimeTicks::Now(); | 196 base::TimeTicks now = gfx::FrameTime::Now(); |
| 196 timestamps_state->SetDouble( | 197 timestamps_state->SetDouble( |
| 197 "0_interval", last_begin_frame_args_.interval.InMicroseconds() / 1000.0L); | 198 "0_interval", last_begin_frame_args_.interval.InMicroseconds() / 1000.0L); |
| 198 timestamps_state->SetDouble( | 199 timestamps_state->SetDouble( |
| 199 "1_now_to_deadline", | 200 "1_now_to_deadline", |
| 200 (last_begin_frame_args_.deadline - now).InMicroseconds() / 1000.0L); | 201 (last_begin_frame_args_.deadline - now).InMicroseconds() / 1000.0L); |
| 201 timestamps_state->SetDouble( | 202 timestamps_state->SetDouble( |
| 202 "2_frame_time_to_now", | 203 "2_frame_time_to_now", |
| 203 (now - last_begin_frame_args_.frame_time).InMicroseconds() / 1000.0L); | 204 (now - last_begin_frame_args_.frame_time).InMicroseconds() / 1000.0L); |
| 204 timestamps_state->SetDouble( | 205 timestamps_state->SetDouble( |
| 205 "3_frame_time_to_deadline", | 206 "3_frame_time_to_deadline", |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 case OUTPUT_SURFACE_ACTIVE: | 1025 case OUTPUT_SURFACE_ACTIVE: |
| 1025 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1026 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
| 1026 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1027 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
| 1027 return true; | 1028 return true; |
| 1028 } | 1029 } |
| 1029 NOTREACHED(); | 1030 NOTREACHED(); |
| 1030 return false; | 1031 return false; |
| 1031 } | 1032 } |
| 1032 | 1033 |
| 1033 } // namespace cc | 1034 } // namespace cc |
| OLD | NEW |