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_TIME_SOURCE_H_ | 5 #ifndef CC_TIME_SOURCE_H_ |
6 #define CC_TIME_SOURCE_H_ | 6 #define CC_TIME_SOURCE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 class Thread; | 14 class TimeSourceClient { |
| 15 public: |
| 16 virtual void onTimerTick() = 0; |
15 | 17 |
16 class TimeSourceClient { | 18 protected: |
17 public: | 19 virtual ~TimeSourceClient() {} |
18 virtual void onTimerTick() = 0; | |
19 | |
20 protected: | |
21 virtual ~TimeSourceClient() { } | |
22 }; | 20 }; |
23 | 21 |
24 // An generic interface for getting a reliably-ticking timesource of | 22 // An generic interface for getting a reliably-ticking timesource of |
25 // a specified rate. | 23 // a specified rate. |
26 // | 24 // |
27 // Be sure to call setActive(false) before releasing your reference to the | 25 // Be sure to call setActive(false) before releasing your reference to the |
28 // timer, or it will keep on ticking! | 26 // timer, or it will keep on ticking! |
29 class CC_EXPORT TimeSource : public base::RefCounted<TimeSource> { | 27 class CC_EXPORT TimeSource : public base::RefCounted<TimeSource> { |
30 public: | 28 public: |
31 virtual void setClient(TimeSourceClient*) = 0; | 29 virtual void setClient(TimeSourceClient*) = 0; |
32 virtual void setActive(bool) = 0; | 30 virtual void setActive(bool) = 0; |
33 virtual bool active() const = 0; | 31 virtual bool active() const = 0; |
34 virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelt
a interval) = 0; | 32 virtual void setTimebaseAndInterval(base::TimeTicks timebase, |
35 virtual base::TimeTicks lastTickTime() = 0; | 33 base::TimeDelta interval) = 0; |
36 virtual base::TimeTicks nextTickTime() = 0; | 34 virtual base::TimeTicks lastTickTime() = 0; |
| 35 virtual base::TimeTicks nextTickTime() = 0; |
37 | 36 |
38 protected: | 37 protected: |
39 virtual ~TimeSource() { } | 38 virtual ~TimeSource() {} |
40 | 39 |
41 private: | 40 private: |
42 friend class base::RefCounted<TimeSource>; | 41 friend class base::RefCounted<TimeSource>; |
43 }; | 42 }; |
44 | 43 |
45 } | 44 } // namespace cc |
| 45 |
46 #endif // CC_TIME_SOURCE_H_ | 46 #endif // CC_TIME_SOURCE_H_ |
OLD | NEW |