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

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

Issue 2172153002: Move FrameLoader completion check timer to loading task runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't lazy create the frame scheduler Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 { 152 {
153 return !ThreadHeap::willObjectBeLazilySwept(objectPointer); 153 return !ThreadHeap::willObjectBeLazilySwept(objectPointer);
154 } 154 }
155 }; 155 };
156 156
157 template <typename TimerFiredClass> 157 template <typename TimerFiredClass>
158 class Timer : public TimerBase { 158 class Timer : public TimerBase {
159 public: 159 public:
160 using TimerFiredFunction = void (TimerFiredClass::*)(Timer<TimerFiredClass>* ); 160 using TimerFiredFunction = void (TimerFiredClass::*)(Timer<TimerFiredClass>* );
161 161
162 // TODO(dcheng): Consider removing this overload once all timers are using t he
163 // appropriate task runner. https://crbug.com/624694
162 Timer(TimerFiredClass* o, TimerFiredFunction f) 164 Timer(TimerFiredClass* o, TimerFiredFunction f)
163 : m_object(o), m_function(f) 165 : m_object(o), m_function(f)
164 { 166 {
165 } 167 }
166 168
169 Timer(TimerFiredClass* o, TimerFiredFunction f, WebTaskRunner* webTaskRunner )
170 : TimerBase(webTaskRunner), m_object(o), m_function(f)
171 {
172 }
173
167 ~Timer() override { } 174 ~Timer() override { }
168 175
169 protected: 176 protected:
170 void fired() override 177 void fired() override
171 { 178 {
172 (m_object->*m_function)(this); 179 (m_object->*m_function)(this);
173 } 180 }
174 181
175 NO_LAZY_SWEEP_SANITIZE_ADDRESS 182 NO_LAZY_SWEEP_SANITIZE_ADDRESS
176 bool canFire() const override 183 bool canFire() const override
177 { 184 {
178 // Oilpan: if a timer fires while Oilpan heaps are being lazily 185 // Oilpan: if a timer fires while Oilpan heaps are being lazily
179 // swept, it is not safe to proceed if the object is about to 186 // swept, it is not safe to proceed if the object is about to
180 // be swept (and this timer will be stopped while doing so.) 187 // be swept (and this timer will be stopped while doing so.)
181 return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_obj ect); 188 return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_obj ect);
182 } 189 }
183 190
184 Timer(TimerFiredClass* o, TimerFiredFunction f, WebTaskRunner* webTaskRunner )
185 : TimerBase(webTaskRunner), m_object(o), m_function(f)
186 {
187 }
188
189 private: 191 private:
190 // FIXME: Oilpan: TimerBase should be moved to the heap and m_object should be traced. 192 // FIXME: Oilpan: TimerBase should be moved to the heap and m_object should be traced.
191 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha t's the case 193 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha t's the case
192 // in the current code base). 194 // in the current code base).
193 GC_PLUGIN_IGNORE("363031") 195 GC_PLUGIN_IGNORE("363031")
194 TimerFiredClass* m_object; 196 TimerFiredClass* m_object;
195 TimerFiredFunction m_function; 197 TimerFiredFunction m_function;
196 }; 198 };
197 199
198 // This subclass of Timer posts its tasks on the current thread's default task r unner. 200 // This subclass of Timer posts its tasks on the current thread's default task r unner.
(...skipping 14 matching lines...) Expand all
213 NO_LAZY_SWEEP_SANITIZE_ADDRESS 215 NO_LAZY_SWEEP_SANITIZE_ADDRESS
214 inline bool TimerBase::isActive() const 216 inline bool TimerBase::isActive() const
215 { 217 {
216 ASSERT(m_thread == currentThread()); 218 ASSERT(m_thread == currentThread());
217 return m_cancellableTimerTask; 219 return m_cancellableTimerTask;
218 } 220 }
219 221
220 } // namespace blink 222 } // namespace blink
221 223
222 #endif // Timer_h 224 #endif // Timer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698