OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 } | 60 } |
61 | 61 |
62 void stop(); | 62 void stop(); |
63 bool isActive() const; | 63 bool isActive() const; |
64 const WebTraceLocation& location() const { return m_location; } | 64 const WebTraceLocation& location() const { return m_location; } |
65 | 65 |
66 double nextFireInterval() const; | 66 double nextFireInterval() const; |
67 double repeatInterval() const { return m_repeatInterval; } | 67 double repeatInterval() const { return m_repeatInterval; } |
68 | 68 |
69 void augmentRepeatInterval(double delta) { | 69 void augmentRepeatInterval(double delta) { |
70 double now = monotonicallyIncreasingTime(); | 70 double now = timerMonotonicallyIncreasingTime(); |
71 setNextFireTime(now, m_nextFireTime - now + delta); | 71 setNextFireTime(now, m_nextFireTime - now + delta); |
72 m_repeatInterval += delta; | 72 m_repeatInterval += delta; |
73 } | 73 } |
74 | 74 |
75 struct PLATFORM_EXPORT Comparator { | 75 struct PLATFORM_EXPORT Comparator { |
76 bool operator()(const TimerBase* a, const TimerBase* b) const; | 76 bool operator()(const TimerBase* a, const TimerBase* b) const; |
77 }; | 77 }; |
78 | 78 |
79 protected: | 79 protected: |
80 static WebTaskRunner* UnthrottledWebTaskRunner(); | 80 static WebTaskRunner* UnthrottledWebTaskRunner(); |
81 | 81 |
82 private: | 82 private: |
83 virtual void fired() = 0; | 83 virtual void fired() = 0; |
84 | 84 |
85 virtual WebTaskRunner* timerTaskRunner(); | 85 virtual WebTaskRunner* timerTaskRunner() const; |
86 | 86 |
87 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 87 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
88 virtual bool canFire() const { return true; } | 88 virtual bool canFire() const { return true; } |
89 | 89 |
90 double timerMonotonicallyIncreasingTime() const | |
91 { | |
esprehn
2016/02/23 10:30:11
Does this really need to be inline in the header?
alex clarke (OOO till 29th)
2016/02/23 17:16:57
I guess it doesn't really matter if it's defined i
| |
92 return timerTaskRunner()->monotonicallyIncreasingVirtualTimeSeconds(); | |
93 } | |
94 | |
90 void setNextFireTime(double now, double delay); | 95 void setNextFireTime(double now, double delay); |
91 | 96 |
92 void runInternal(); | 97 void runInternal(); |
93 | 98 |
94 class CancellableTimerTask final : public WebTaskRunner::Task { | 99 class CancellableTimerTask final : public WebTaskRunner::Task { |
95 WTF_MAKE_NONCOPYABLE(CancellableTimerTask); | 100 WTF_MAKE_NONCOPYABLE(CancellableTimerTask); |
96 public: | 101 public: |
97 explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { } | 102 explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { } |
98 | 103 |
99 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 104 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 216 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
212 inline bool TimerBase::isActive() const | 217 inline bool TimerBase::isActive() const |
213 { | 218 { |
214 ASSERT(m_thread == currentThread()); | 219 ASSERT(m_thread == currentThread()); |
215 return m_cancellableTimerTask; | 220 return m_cancellableTimerTask; |
216 } | 221 } |
217 | 222 |
218 } // namespace blink | 223 } // namespace blink |
219 | 224 |
220 #endif // Timer_h | 225 #endif // Timer_h |
OLD | NEW |