blob: 58d50dd6f6af038858226a288ea55900f878eaee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CCTimer_h
#define CCTimer_h
namespace cc {
class CCThread;
class CCTimerTask;
class CCTimerClient {
public:
virtual ~CCTimerClient() { }
virtual void onTimerFired() = 0;
};
class CCTimer {
public:
CCTimer(CCThread*, CCTimerClient*);
~CCTimer();
// If a previous task is pending, it will be replaced with the new one.
void startOneShot(double intervalSeconds);
void stop();
bool isActive() const { return m_task; }
private:
friend class CCTimerTask;
CCTimerClient* m_client;
CCThread* m_thread;
CCTimerTask* m_task; // weak pointer
};
} // namespace cc
#endif
|