| 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/delay_based_time_source.h" | 5 #include "cc/scheduler/delay_based_time_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/debug/trace_event_argument.h" |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // kDoubleTickDivisor prevents ticks from running within the specified | 22 // kDoubleTickDivisor prevents ticks from running within the specified |
| 22 // fraction of an interval. This helps account for jitter in the timebase as | 23 // fraction of an interval. This helps account for jitter in the timebase as |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 283 } |
| 283 | 284 |
| 284 std::string DelayBasedTimeSource::TypeString() const { | 285 std::string DelayBasedTimeSource::TypeString() const { |
| 285 return "DelayBasedTimeSource"; | 286 return "DelayBasedTimeSource"; |
| 286 } | 287 } |
| 287 | 288 |
| 288 std::string DelayBasedTimeSourceHighRes::TypeString() const { | 289 std::string DelayBasedTimeSourceHighRes::TypeString() const { |
| 289 return "DelayBasedTimeSourceHighRes"; | 290 return "DelayBasedTimeSourceHighRes"; |
| 290 } | 291 } |
| 291 | 292 |
| 292 scoped_ptr<base::Value> DelayBasedTimeSource::AsValue() const { | 293 void DelayBasedTimeSource::AsValueInto(base::debug::TracedValue* state) const { |
| 293 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); | |
| 294 state->SetString("type", TypeString()); | 294 state->SetString("type", TypeString()); |
| 295 state->SetDouble("last_tick_time_us", LastTickTime().ToInternalValue()); | 295 state->SetDouble("last_tick_time_us", LastTickTime().ToInternalValue()); |
| 296 state->SetDouble("next_tick_time_us", NextTickTime().ToInternalValue()); | 296 state->SetDouble("next_tick_time_us", NextTickTime().ToInternalValue()); |
| 297 | 297 |
| 298 scoped_ptr<base::DictionaryValue> state_current_parameters( | 298 state->BeginDictionary("current_parameters"); |
| 299 new base::DictionaryValue); | 299 state->SetDouble("interval_us", |
| 300 state_current_parameters->SetDouble( | 300 current_parameters_.interval.InMicroseconds()); |
| 301 "interval_us", current_parameters_.interval.InMicroseconds()); | 301 state->SetDouble("tick_target_us", |
| 302 state_current_parameters->SetDouble( | 302 current_parameters_.tick_target.ToInternalValue()); |
| 303 "tick_target_us", current_parameters_.tick_target.ToInternalValue()); | 303 state->EndDictionary(); |
| 304 state->Set("current_parameters", state_current_parameters.release()); | |
| 305 | 304 |
| 306 scoped_ptr<base::DictionaryValue> state_next_parameters( | 305 state->BeginDictionary("next_parameters"); |
| 307 new base::DictionaryValue); | 306 state->SetDouble("interval_us", next_parameters_.interval.InMicroseconds()); |
| 308 state_next_parameters->SetDouble("interval_us", | 307 state->SetDouble("tick_target_us", |
| 309 next_parameters_.interval.InMicroseconds()); | 308 next_parameters_.tick_target.ToInternalValue()); |
| 310 state_next_parameters->SetDouble( | 309 state->EndDictionary(); |
| 311 "tick_target_us", next_parameters_.tick_target.ToInternalValue()); | |
| 312 state->Set("next_parameters", state_next_parameters.release()); | |
| 313 | 310 |
| 314 state->SetBoolean("active", active_); | 311 state->SetBoolean("active", active_); |
| 315 | |
| 316 return state.PassAs<base::Value>(); | |
| 317 } | 312 } |
| 318 | 313 |
| 319 } // namespace cc | 314 } // namespace cc |
| OLD | NEW |