| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 static WebTaskRunner* getTimerTaskRunner(); | 83 static WebTaskRunner* getTimerTaskRunner(); |
| 84 static WebTaskRunner* getUnthrottledTaskRunner(); | 84 static WebTaskRunner* getUnthrottledTaskRunner(); |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 virtual void fired() = 0; | 87 virtual void fired() = 0; |
| 88 | 88 |
| 89 virtual WebTaskRunner* timerTaskRunner() const; | 89 virtual WebTaskRunner* timerTaskRunner() const; |
| 90 | 90 |
| 91 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 91 NO_SANITIZE_ADDRESS |
| 92 virtual bool canFire() const { return true; } | 92 virtual bool canFire() const { return true; } |
| 93 | 93 |
| 94 double timerMonotonicallyIncreasingTime() const; | 94 double timerMonotonicallyIncreasingTime() const; |
| 95 | 95 |
| 96 void setNextFireTime(double now, double delay); | 96 void setNextFireTime(double now, double delay); |
| 97 | 97 |
| 98 void runInternal(); | 98 void runInternal(); |
| 99 | 99 |
| 100 double m_nextFireTime; // 0 if inactive | 100 double m_nextFireTime; // 0 if inactive |
| 101 double m_repeatInterval; // 0 if not repeating | 101 double m_repeatInterval; // 0 if not repeating |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 TaskRunnerTimer(WebTaskRunner* webTaskRunner, | 134 TaskRunnerTimer(WebTaskRunner* webTaskRunner, |
| 135 TimerFiredClass* o, | 135 TimerFiredClass* o, |
| 136 TimerFiredFunction f) | 136 TimerFiredFunction f) |
| 137 : TimerBase(webTaskRunner), m_object(o), m_function(f) {} | 137 : TimerBase(webTaskRunner), m_object(o), m_function(f) {} |
| 138 | 138 |
| 139 ~TaskRunnerTimer() override {} | 139 ~TaskRunnerTimer() override {} |
| 140 | 140 |
| 141 protected: | 141 protected: |
| 142 void fired() override { (m_object->*m_function)(this); } | 142 void fired() override { (m_object->*m_function)(this); } |
| 143 | 143 |
| 144 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 144 NO_SANITIZE_ADDRESS |
| 145 bool canFire() const override { | 145 bool canFire() const override { |
| 146 // Oilpan: if a timer fires while Oilpan heaps are being lazily | 146 // Oilpan: if a timer fires while Oilpan heaps are being lazily |
| 147 // swept, it is not safe to proceed if the object is about to | 147 // swept, it is not safe to proceed if the object is about to |
| 148 // be swept (and this timer will be stopped while doing so.) | 148 // be swept (and this timer will be stopped while doing so.) |
| 149 return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive( | 149 return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive( |
| 150 m_object); | 150 m_object); |
| 151 } | 151 } |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 // FIXME: Oilpan: TimerBase should be moved to the heap and m_object should be
traced. | 154 // FIXME: Oilpan: TimerBase should be moved to the heap and m_object should be
traced. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 185 | 185 |
| 186 ~UnthrottledThreadTimer() override {} | 186 ~UnthrottledThreadTimer() override {} |
| 187 | 187 |
| 188 UnthrottledThreadTimer(TimerFiredClass* timerFiredClass, | 188 UnthrottledThreadTimer(TimerFiredClass* timerFiredClass, |
| 189 TimerFiredFunction timerFiredFunction) | 189 TimerFiredFunction timerFiredFunction) |
| 190 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getUnthrottledTaskRunner(), | 190 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getUnthrottledTaskRunner(), |
| 191 timerFiredClass, | 191 timerFiredClass, |
| 192 timerFiredFunction) {} | 192 timerFiredFunction) {} |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 195 NO_SANITIZE_ADDRESS |
| 196 inline bool TimerBase::isActive() const { | 196 inline bool TimerBase::isActive() const { |
| 197 ASSERT(m_thread == currentThread()); | 197 ASSERT(m_thread == currentThread()); |
| 198 return m_weakPtrFactory.hasWeakPtrs(); | 198 return m_weakPtrFactory.hasWeakPtrs(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| 202 | 202 |
| 203 #endif // Timer_h | 203 #endif // Timer_h |
| OLD | NEW |