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