| 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 #ifndef CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ | 5 #ifndef CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ |
| 6 #define CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ | 6 #define CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/scheduler/time_source.h" | 10 #include "cc/scheduler/time_source.h" |
| 11 | 11 |
| 12 namespace base { class SingleThreadTaskRunner; } | 12 namespace base { class SingleThreadTaskRunner; } |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 // This timer implements a time source that achieves the specified interval | 16 // This timer implements a time source that achieves the specified interval |
| 17 // in face of millisecond-precision delayed callbacks and random queueing | 17 // in face of millisecond-precision delayed callbacks and random queueing |
| 18 // delays. | 18 // delays. DelayBasedTimeSource uses base::TimeTicks::Now as its timebase. |
| 19 class CC_EXPORT DelayBasedTimeSource : public TimeSource { | 19 class CC_EXPORT DelayBasedTimeSource : public TimeSource { |
| 20 public: | 20 public: |
| 21 static scoped_refptr<DelayBasedTimeSource> Create( | 21 static scoped_refptr<DelayBasedTimeSource> Create( |
| 22 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner); | 22 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner); |
| 23 | 23 |
| 24 virtual void SetClient(TimeSourceClient* client) OVERRIDE; | 24 virtual void SetClient(TimeSourceClient* client) OVERRIDE; |
| 25 | 25 |
| 26 // TimeSource implementation | 26 // TimeSource implementation |
| 27 virtual void SetTimebaseAndInterval(base::TimeTicks timebase, | 27 virtual void SetTimebaseAndInterval(base::TimeTicks timebase, |
| 28 base::TimeDelta interval) OVERRIDE; | 28 base::TimeDelta interval) OVERRIDE; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 bool active_; | 67 bool active_; |
| 68 | 68 |
| 69 base::SingleThreadTaskRunner* task_runner_; | 69 base::SingleThreadTaskRunner* task_runner_; |
| 70 base::WeakPtrFactory<DelayBasedTimeSource> weak_factory_; | 70 base::WeakPtrFactory<DelayBasedTimeSource> weak_factory_; |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource); | 73 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSource); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // DelayBasedTimeSource uses base::TimeTicks::HighResNow as its timebase. |
| 77 class DelayBasedTimeSourceHighRes : public DelayBasedTimeSource { |
| 78 public: |
| 79 static scoped_refptr<DelayBasedTimeSourceHighRes> Create( |
| 80 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner); |
| 81 |
| 82 virtual base::TimeTicks Now() const OVERRIDE; |
| 83 |
| 84 protected: |
| 85 DelayBasedTimeSourceHighRes(base::TimeDelta interval, |
| 86 base::SingleThreadTaskRunner* task_runner); |
| 87 virtual ~DelayBasedTimeSourceHighRes(); |
| 88 |
| 89 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(DelayBasedTimeSourceHighRes); |
| 91 }; |
| 92 |
| 76 } // namespace cc | 93 } // namespace cc |
| 77 | 94 |
| 78 #endif // CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ | 95 #endif // CC_SCHEDULER_DELAY_BASED_TIME_SOURCE_H_ |
| OLD | NEW |