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