| 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 CCDelayBasedTimeSource_h | 5 #ifndef CCDelayBasedTimeSource_h |
| 6 #define CCDelayBasedTimeSource_h | 6 #define CCDelayBasedTimeSource_h |
| 7 | 7 |
| 8 #include "CCTimeSource.h" | 8 #include "CCTimeSource.h" |
| 9 #include "CCTimer.h" | 9 #include "CCTimer.h" |
| 10 #include <wtf/PassRefPtr.h> | 10 #include <wtf/PassRefPtr.h> |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class CCThread; | 14 class CCThread; |
| 15 | 15 |
| 16 // This timer implements a time source that achieves the specified interval | 16 // This timer implements a time source that achieves the specified interval |
| 17 // in face of millisecond-precision delayed callbacks and random queueing delays
. | 17 // in face of millisecond-precision delayed callbacks and random queueing delays
. |
| 18 class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient { | 18 class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient { |
| 19 public: | 19 public: |
| 20 static PassRefPtr<CCDelayBasedTimeSource> create(double intervalSeconds, CCT
hread*); | 20 static PassRefPtr<CCDelayBasedTimeSource> create(double intervalSeconds, CCT
hread*); |
| 21 | 21 |
| 22 virtual ~CCDelayBasedTimeSource() { } | 22 virtual ~CCDelayBasedTimeSource() { } |
| 23 | 23 |
| 24 virtual void setClient(CCTimeSourceClient* client) OVERRIDE { m_client = cli
ent; } | 24 virtual void setClient(CCTimeSourceClient* client) OVERRIDE; |
| 25 | 25 |
| 26 // CCTimeSource implementation | 26 // CCTimeSource implementation |
| 27 virtual void setTimebaseAndInterval(double timebase, double intervalSeconds)
OVERRIDE; | 27 virtual void setTimebaseAndInterval(double timebase, double intervalSeconds)
OVERRIDE; |
| 28 | 28 |
| 29 virtual void setActive(bool) OVERRIDE; | 29 virtual void setActive(bool) OVERRIDE; |
| 30 virtual bool active() const OVERRIDE { return m_state != STATE_INACTIVE; } | 30 virtual bool active() const OVERRIDE; |
| 31 | 31 |
| 32 // Get the last and next tick times. | 32 // Get the last and next tick times. |
| 33 virtual double lastTickTime() OVERRIDE; | 33 virtual double lastTickTime() OVERRIDE; |
| 34 virtual double nextTickTimeIfActivated() OVERRIDE; | 34 virtual double nextTickTimeIfActivated() OVERRIDE; |
| 35 | 35 |
| 36 // CCTimerClient implementation. | 36 // CCTimerClient implementation. |
| 37 virtual void onTimerFired() OVERRIDE; | 37 virtual void onTimerFired() OVERRIDE; |
| 38 | 38 |
| 39 // Virtual for testing. | 39 // Virtual for testing. |
| 40 virtual double monotonicTimeNow() const; | 40 virtual double monotonicTimeNow() const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 69 Parameters m_currentParameters; | 69 Parameters m_currentParameters; |
| 70 Parameters m_nextParameters; | 70 Parameters m_nextParameters; |
| 71 | 71 |
| 72 State m_state; | 72 State m_state; |
| 73 CCThread* m_thread; | 73 CCThread* m_thread; |
| 74 CCTimer m_timer; | 74 CCTimer m_timer; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } | 77 } |
| 78 #endif // CCDelayBasedTimeSource_h | 78 #endif // CCDelayBasedTimeSource_h |
| OLD | NEW |