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