summaryrefslogtreecommitdiffstats
path: root/cc/CCTimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'cc/CCTimer.h')
-rw-r--r--cc/CCTimer.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/cc/CCTimer.h b/cc/CCTimer.h
new file mode 100644
index 0000000..7cf3340
--- /dev/null
+++ b/cc/CCTimer.h
@@ -0,0 +1,42 @@
+// 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 WebCore {
+
+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 WebCore
+
+#endif