| 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 = timerMonotonicallyIncreasingTime(); | 70 double now = monotonicallyIncreasingTime(); |
| 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() const; | 85 virtual WebTaskRunner* timerTaskRunner(); |
| 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 | |
| 92 void setNextFireTime(double now, double delay); | 90 void setNextFireTime(double now, double delay); |
| 93 | 91 |
| 94 void runInternal(); | 92 void runInternal(); |
| 95 | 93 |
| 96 class CancellableTimerTask final : public WebTaskRunner::Task { | 94 class CancellableTimerTask final : public WebTaskRunner::Task { |
| 97 WTF_MAKE_NONCOPYABLE(CancellableTimerTask); | 95 WTF_MAKE_NONCOPYABLE(CancellableTimerTask); |
| 98 public: | 96 public: |
| 99 explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { } | 97 explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { } |
| 100 | 98 |
| 101 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 99 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 211 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 214 inline bool TimerBase::isActive() const | 212 inline bool TimerBase::isActive() const |
| 215 { | 213 { |
| 216 ASSERT(m_thread == currentThread()); | 214 ASSERT(m_thread == currentThread()); |
| 217 return m_cancellableTimerTask; | 215 return m_cancellableTimerTask; |
| 218 } | 216 } |
| 219 | 217 |
| 220 } // namespace blink | 218 } // namespace blink |
| 221 | 219 |
| 222 #endif // Timer_h | 220 #endif // Timer_h |
| OLD | NEW |