| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 Timer(TimerFiredClass* timerFiredClass, TimerFiredFunction timerFiredFunction) | 175 Timer(TimerFiredClass* timerFiredClass, TimerFiredFunction timerFiredFunction) |
| 176 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getTimerTaskRunner(), | 176 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getTimerTaskRunner(), |
| 177 timerFiredClass, | 177 timerFiredClass, |
| 178 timerFiredFunction) {} | 178 timerFiredFunction) {} |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 // This subclass of Timer posts its tasks on the current thread's default task | 181 // This subclass of Timer posts its tasks on the current thread's default task |
| 182 // runner. Tasks posted on there are not throttled when the tab is in the | 182 // runner. Tasks posted on there are not throttled when the tab is in the |
| 183 // background. | 183 // background. |
| 184 // |
| 185 // DEPRECATED: Use TaskRunnerHelper::get with TaskType::Unthrottled. |
| 184 template <typename TimerFiredClass> | 186 template <typename TimerFiredClass> |
| 185 class UnthrottledThreadTimer : public TaskRunnerTimer<TimerFiredClass> { | 187 class UnthrottledThreadTimer : public TaskRunnerTimer<TimerFiredClass> { |
| 186 public: | 188 public: |
| 187 using TimerFiredFunction = | 189 using TimerFiredFunction = |
| 188 typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction; | 190 typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction; |
| 189 | 191 |
| 190 ~UnthrottledThreadTimer() override {} | 192 ~UnthrottledThreadTimer() override {} |
| 191 | 193 |
| 192 UnthrottledThreadTimer(TimerFiredClass* timerFiredClass, | 194 UnthrottledThreadTimer(TimerFiredClass* timerFiredClass, |
| 193 TimerFiredFunction timerFiredFunction) | 195 TimerFiredFunction timerFiredFunction) |
| 194 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getUnthrottledTaskRunner(), | 196 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getUnthrottledTaskRunner(), |
| 195 timerFiredClass, | 197 timerFiredClass, |
| 196 timerFiredFunction) {} | 198 timerFiredFunction) {} |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 NO_SANITIZE_ADDRESS | 201 NO_SANITIZE_ADDRESS |
| 200 inline bool TimerBase::isActive() const { | 202 inline bool TimerBase::isActive() const { |
| 201 #if DCHECK_IS_ON() | 203 #if DCHECK_IS_ON() |
| 202 DCHECK_EQ(m_thread, currentThread()); | 204 DCHECK_EQ(m_thread, currentThread()); |
| 203 #endif | 205 #endif |
| 204 return m_weakPtrFactory.hasWeakPtrs(); | 206 return m_weakPtrFactory.hasWeakPtrs(); |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace blink | 209 } // namespace blink |
| 208 | 210 |
| 209 #endif // Timer_h | 211 #endif // Timer_h |
| OLD | NEW |