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