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
3 // found in the LICENSE file.
5 #ifndef CC_TIME_SOURCE_H_
6 #define CC_TIME_SOURCE_H_
8 #include "base/memory/ref_counted.h"
10 #include "cc/cc_export.h"
14 class TimeSourceClient
{
16 virtual void onTimerTick() = 0;
19 virtual ~TimeSourceClient() {}
22 // An generic interface for getting a reliably-ticking timesource of
25 // Be sure to call setActive(false) before releasing your reference to the
26 // timer, or it will keep on ticking!
27 class CC_EXPORT TimeSource
: public base::RefCounted
<TimeSource
> {
29 virtual void setClient(TimeSourceClient
*) = 0;
30 virtual void setActive(bool) = 0;
31 virtual bool active() const = 0;
32 virtual void setTimebaseAndInterval(base::TimeTicks timebase
,
33 base::TimeDelta interval
) = 0;
34 virtual base::TimeTicks
lastTickTime() = 0;
35 virtual base::TimeTicks
nextTickTime() = 0;
38 virtual ~TimeSource() {}
41 friend class base::RefCounted
<TimeSource
>;
46 #endif // CC_TIME_SOURCE_H_