Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: third_party/WebKit/Source/platform/Timer.h

Issue 2388303002: reflow comments in platform/ (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 NO_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
155 // This raw pointer is safe as long as Timer<X> is held by the X itself (That' s the case 155 // traced. This raw pointer is safe as long as Timer<X> is held by the X
156 // itself (That's the case
156 // in the current code base). 157 // in the current code base).
157 GC_PLUGIN_IGNORE("363031") 158 GC_PLUGIN_IGNORE("363031")
158 TimerFiredClass* m_object; 159 TimerFiredClass* m_object;
159 TimerFiredFunction m_function; 160 TimerFiredFunction m_function;
160 }; 161 };
161 162
162 // TODO(dcheng): Consider removing this overload once all timers are using the 163 // TODO(dcheng): Consider removing this overload once all timers are using the
163 // appropriate task runner. https://crbug.com/624694 164 // appropriate task runner. https://crbug.com/624694
164 template <typename TimerFiredClass> 165 template <typename TimerFiredClass>
165 class Timer : public TaskRunnerTimer<TimerFiredClass> { 166 class Timer : public TaskRunnerTimer<TimerFiredClass> {
166 public: 167 public:
167 using TimerFiredFunction = 168 using TimerFiredFunction =
168 typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction; 169 typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction;
169 170
170 ~Timer() override {} 171 ~Timer() override {}
171 172
172 Timer(TimerFiredClass* timerFiredClass, TimerFiredFunction timerFiredFunction) 173 Timer(TimerFiredClass* timerFiredClass, TimerFiredFunction timerFiredFunction)
173 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getTimerTaskRunner(), 174 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getTimerTaskRunner(),
174 timerFiredClass, 175 timerFiredClass,
175 timerFiredFunction) {} 176 timerFiredFunction) {}
176 }; 177 };
177 178
178 // This subclass of Timer posts its tasks on the current thread's default task r unner. 179 // This subclass of Timer posts its tasks on the current thread's default task
179 // Tasks posted on there are not throttled when the tab is in the background. 180 // runner. Tasks posted on there are not throttled when the tab is in the
181 // background.
180 template <typename TimerFiredClass> 182 template <typename TimerFiredClass>
181 class UnthrottledThreadTimer : public TaskRunnerTimer<TimerFiredClass> { 183 class UnthrottledThreadTimer : public TaskRunnerTimer<TimerFiredClass> {
182 public: 184 public:
183 using TimerFiredFunction = 185 using TimerFiredFunction =
184 typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction; 186 typename TaskRunnerTimer<TimerFiredClass>::TimerFiredFunction;
185 187
186 ~UnthrottledThreadTimer() override {} 188 ~UnthrottledThreadTimer() override {}
187 189
188 UnthrottledThreadTimer(TimerFiredClass* timerFiredClass, 190 UnthrottledThreadTimer(TimerFiredClass* timerFiredClass,
189 TimerFiredFunction timerFiredFunction) 191 TimerFiredFunction timerFiredFunction)
190 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getUnthrottledTaskRunner(), 192 : TaskRunnerTimer<TimerFiredClass>(TimerBase::getUnthrottledTaskRunner(),
191 timerFiredClass, 193 timerFiredClass,
192 timerFiredFunction) {} 194 timerFiredFunction) {}
193 }; 195 };
194 196
195 NO_SANITIZE_ADDRESS 197 NO_SANITIZE_ADDRESS
196 inline bool TimerBase::isActive() const { 198 inline bool TimerBase::isActive() const {
197 ASSERT(m_thread == currentThread()); 199 ASSERT(m_thread == currentThread());
198 return m_weakPtrFactory.hasWeakPtrs(); 200 return m_weakPtrFactory.hasWeakPtrs();
199 } 201 }
200 202
201 } // namespace blink 203 } // namespace blink
202 204
203 #endif // Timer_h 205 #endif // Timer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/Theme.h ('k') | third_party/WebKit/Source/platform/Timer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698