| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // interval that will trigger an immediate phase change. If the changes are | 29 // interval that will trigger an immediate phase change. If the changes are |
| 30 // within the thresholds, the change will take place on the next tick. If | 30 // within the thresholds, the change will take place on the next tick. If |
| 31 // either change is outside the thresholds, the next tick will be canceled and | 31 // either change is outside the thresholds, the next tick will be canceled and |
| 32 // reissued immediately. | 32 // reissued immediately. |
| 33 static const double kIntervalChangeThreshold = 0.25; | 33 static const double kIntervalChangeThreshold = 0.25; |
| 34 static const double kPhaseChangeThreshold = 0.25; | 34 static const double kPhaseChangeThreshold = 0.25; |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 // The following methods correspond to the DelayBasedTimeSource that uses | 38 // The following methods correspond to the DelayBasedTimeSource that uses |
| 39 // the base::TimeTicks::HighResNow as the timebase. | 39 // the base::TimeTicks::Now as the timebase. |
| 40 scoped_refptr<DelayBasedTimeSourceHighRes> DelayBasedTimeSourceHighRes::Create( | 40 scoped_refptr<DelayBasedTimeSourceHighRes> DelayBasedTimeSourceHighRes::Create( |
| 41 base::TimeDelta interval, | 41 base::TimeDelta interval, |
| 42 base::SingleThreadTaskRunner* task_runner) { | 42 base::SingleThreadTaskRunner* task_runner) { |
| 43 return make_scoped_refptr( | 43 return make_scoped_refptr( |
| 44 new DelayBasedTimeSourceHighRes(interval, task_runner)); | 44 new DelayBasedTimeSourceHighRes(interval, task_runner)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DelayBasedTimeSourceHighRes::DelayBasedTimeSourceHighRes( | 47 DelayBasedTimeSourceHighRes::DelayBasedTimeSourceHighRes( |
| 48 base::TimeDelta interval, | 48 base::TimeDelta interval, |
| 49 base::SingleThreadTaskRunner* task_runner) | 49 base::SingleThreadTaskRunner* task_runner) |
| 50 : DelayBasedTimeSource(interval, task_runner) { | 50 : DelayBasedTimeSource(interval, task_runner) { |
| 51 } | 51 } |
| 52 | 52 |
| 53 DelayBasedTimeSourceHighRes::~DelayBasedTimeSourceHighRes() {} | 53 DelayBasedTimeSourceHighRes::~DelayBasedTimeSourceHighRes() {} |
| 54 | 54 |
| 55 base::TimeTicks DelayBasedTimeSourceHighRes::Now() const { | 55 base::TimeTicks DelayBasedTimeSourceHighRes::Now() const { |
| 56 return base::TimeTicks::HighResNow(); | 56 return base::TimeTicks::Now(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // The following methods correspond to the DelayBasedTimeSource that uses | 59 // The following methods correspond to the DelayBasedTimeSource that uses |
| 60 // the base::TimeTicks::Now as the timebase. | 60 // the base::TimeTicks::Now as the timebase. |
| 61 scoped_refptr<DelayBasedTimeSource> DelayBasedTimeSource::Create( | 61 scoped_refptr<DelayBasedTimeSource> DelayBasedTimeSource::Create( |
| 62 base::TimeDelta interval, | 62 base::TimeDelta interval, |
| 63 base::SingleThreadTaskRunner* task_runner) { | 63 base::SingleThreadTaskRunner* task_runner) { |
| 64 return make_scoped_refptr(new DelayBasedTimeSource(interval, task_runner)); | 64 return make_scoped_refptr(new DelayBasedTimeSource(interval, task_runner)); |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 state->BeginDictionary("next_parameters"); | 305 state->BeginDictionary("next_parameters"); |
| 306 state->SetDouble("interval_us", next_parameters_.interval.InMicroseconds()); | 306 state->SetDouble("interval_us", next_parameters_.interval.InMicroseconds()); |
| 307 state->SetDouble("tick_target_us", | 307 state->SetDouble("tick_target_us", |
| 308 next_parameters_.tick_target.ToInternalValue()); | 308 next_parameters_.tick_target.ToInternalValue()); |
| 309 state->EndDictionary(); | 309 state->EndDictionary(); |
| 310 | 310 |
| 311 state->SetBoolean("active", active_); | 311 state->SetBoolean("active", active_); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace cc | 314 } // namespace cc |
| OLD | NEW |