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

Side by Side Diff: Source/platform/Timer.cpp

Issue 1144933004: Revert of Various ASan exemptions to allow Oilpan pre-sweep poisoning of unmarkeds. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « Source/platform/Timer.h ('k') | Source/platform/heap/AddressSanitizer.h » ('j') | 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, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "platform/Timer.h" 28 #include "platform/Timer.h"
29 29
30 #include "platform/PlatformThreadData.h" 30 #include "platform/PlatformThreadData.h"
31 #include "platform/ThreadTimers.h" 31 #include "platform/ThreadTimers.h"
32 #include "platform/heap/AddressSanitizer.h"
33 #include "wtf/Atomics.h" 32 #include "wtf/Atomics.h"
34 #include "wtf/CurrentTime.h" 33 #include "wtf/CurrentTime.h"
35 #include "wtf/HashSet.h" 34 #include "wtf/HashSet.h"
36 #include <algorithm> 35 #include <algorithm>
37 #include <limits.h> 36 #include <limits.h>
38 #include <limits> 37 #include <limits>
39 #include <math.h> 38 #include <math.h>
40 39
41 namespace blink { 40 namespace blink {
42 41
(...skipping 28 matching lines...) Expand all
71 TimerHeapReference& operator=(TimerHeapReference); 70 TimerHeapReference& operator=(TimerHeapReference);
72 private: 71 private:
73 TimerBase*& m_reference; 72 TimerBase*& m_reference;
74 }; 73 };
75 74
76 inline TimerHeapReference TimerHeapPointer::operator*() const 75 inline TimerHeapReference TimerHeapPointer::operator*() const
77 { 76 {
78 return *m_pointer; 77 return *m_pointer;
79 } 78 }
80 79
81 NO_LAZY_SWEEP_SANITIZE_ADDRESS
82 inline TimerHeapReference& TimerHeapReference::operator=(TimerBase* timer) 80 inline TimerHeapReference& TimerHeapReference::operator=(TimerBase* timer)
83 { 81 {
84 m_reference = timer; 82 m_reference = timer;
85 Vector<TimerBase*>& heap = timer->timerHeap(); 83 Vector<TimerBase*>& heap = timer->timerHeap();
86 if (&m_reference >= heap.data() && &m_reference < heap.data() + heap.size()) 84 if (&m_reference >= heap.data() && &m_reference < heap.data() + heap.size())
87 timer->m_heapIndex = &m_reference - heap.data(); 85 timer->m_heapIndex = &m_reference - heap.data();
88 return *this; 86 return *this;
89 } 87 }
90 88
91 NO_LAZY_SWEEP_SANITIZE_ADDRESS
92 inline TimerHeapReference& TimerHeapReference::operator=(TimerHeapReference b) 89 inline TimerHeapReference& TimerHeapReference::operator=(TimerHeapReference b)
93 { 90 {
94 TimerBase* timer = b; 91 TimerBase* timer = b;
95 return *this = timer; 92 return *this = timer;
96 } 93 }
97 94
98 inline void swap(TimerHeapReference a, TimerHeapReference b) 95 inline void swap(TimerHeapReference a, TimerHeapReference b)
99 { 96 {
100 TimerBase* timerA = a; 97 TimerBase* timerA = a;
101 TimerBase* timerB = b; 98 TimerBase* timerB = b;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 inline TimerHeapIterator operator-(TimerHeapIterator a, size_t b) { return Timer HeapIterator(a.m_pointer - b); } 161 inline TimerHeapIterator operator-(TimerHeapIterator a, size_t b) { return Timer HeapIterator(a.m_pointer - b); }
165 inline ptrdiff_t operator-(TimerHeapIterator a, TimerHeapIterator b) { return a. m_pointer - b.m_pointer; } 162 inline ptrdiff_t operator-(TimerHeapIterator a, TimerHeapIterator b) { return a. m_pointer - b.m_pointer; }
166 163
167 // ---------------- 164 // ----------------
168 165
169 class TimerHeapLessThanFunction { 166 class TimerHeapLessThanFunction {
170 public: 167 public:
171 bool operator()(const TimerBase*, const TimerBase*) const; 168 bool operator()(const TimerBase*, const TimerBase*) const;
172 }; 169 };
173 170
174 NO_LAZY_SWEEP_SANITIZE_ADDRESS
175 inline bool TimerHeapLessThanFunction::operator()(const TimerBase* a, const Time rBase* b) const 171 inline bool TimerHeapLessThanFunction::operator()(const TimerBase* a, const Time rBase* b) const
176 { 172 {
177 // The comparisons below are "backwards" because the heap puts the largest 173 // The comparisons below are "backwards" because the heap puts the largest
178 // element first and we want the lowest time to be the first one in the heap . 174 // element first and we want the lowest time to be the first one in the heap .
179 double aFireTime = a->m_nextFireTime; 175 double aFireTime = a->m_nextFireTime;
180 double bFireTime = b->m_nextFireTime; 176 double bFireTime = b->m_nextFireTime;
181 if (bFireTime != aFireTime) 177 if (bFireTime != aFireTime)
182 return bFireTime < aFireTime; 178 return bFireTime < aFireTime;
183 179
184 // We need to look at the difference of the insertion orders instead of comp aring the two 180 // We need to look at the difference of the insertion orders instead of comp aring the two
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 283 }
288 284
289 inline void TimerBase::heapInsert() 285 inline void TimerBase::heapInsert()
290 { 286 {
291 ASSERT(!inHeap()); 287 ASSERT(!inHeap());
292 timerHeap().append(this); 288 timerHeap().append(this);
293 m_heapIndex = timerHeap().size() - 1; 289 m_heapIndex = timerHeap().size() - 1;
294 heapDecreaseKey(); 290 heapDecreaseKey();
295 } 291 }
296 292
297 NO_LAZY_SWEEP_SANITIZE_ADDRESS
298 inline void TimerBase::heapPop() 293 inline void TimerBase::heapPop()
299 { 294 {
300 // Temporarily force this timer to have the minimum key so we can pop it. 295 // Temporarily force this timer to have the minimum key so we can pop it.
301 double fireTime = m_nextFireTime; 296 double fireTime = m_nextFireTime;
302 m_nextFireTime = -std::numeric_limits<double>::infinity(); 297 m_nextFireTime = -std::numeric_limits<double>::infinity();
303 heapDecreaseKey(); 298 heapDecreaseKey();
304 heapPopMin(); 299 heapPopMin();
305 m_nextFireTime = fireTime; 300 m_nextFireTime = fireTime;
306 } 301 }
307 302
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 setNextFireTime(m_unalignedNextFireTime); 400 setNextFireTime(m_unalignedNextFireTime);
406 } 401 }
407 402
408 double TimerBase::nextUnalignedFireInterval() const 403 double TimerBase::nextUnalignedFireInterval() const
409 { 404 {
410 ASSERT(isActive()); 405 ASSERT(isActive());
411 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0 ); 406 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0 );
412 } 407 }
413 408
414 } // namespace blink 409 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/Timer.h ('k') | Source/platform/heap/AddressSanitizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698