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

Side by Side Diff: Source/wtf/Deque.h

Issue 1025623002: Disable inline vector buffers for WTF::Deque for ASAN builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 25 matching lines...) Expand all
36 #include "wtf/PassTraits.h" 36 #include "wtf/PassTraits.h"
37 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include <iterator> 38 #include <iterator>
39 39
40 namespace WTF { 40 namespace WTF {
41 template<typename T, size_t inlineCapacity, typename Allocator> class DequeI teratorBase; 41 template<typename T, size_t inlineCapacity, typename Allocator> class DequeI teratorBase;
42 template<typename T, size_t inlineCapacity, typename Allocator> class DequeI terator; 42 template<typename T, size_t inlineCapacity, typename Allocator> class DequeI terator;
43 template<typename T, size_t inlineCapacity, typename Allocator> class DequeC onstIterator; 43 template<typename T, size_t inlineCapacity, typename Allocator> class DequeC onstIterator;
44 44
45 template<typename T, size_t inlineCapacity = 0, typename Allocator = Default Allocator> 45 template<typename T, size_t inlineCapacity = 0, typename Allocator = Default Allocator>
46 class Deque : public ConditionalDestructor<Deque<T, inlineCapacity, Allocato r>, (inlineCapacity == 0) && Allocator::isGarbageCollected> { 46 class Deque : public ConditionalDestructor<Deque<T, INLINE_CAPACITY, Allocat or>, (INLINE_CAPACITY == 0) && Allocator::isGarbageCollected> {
47 WTF_USE_ALLOCATOR(Deque, Allocator); 47 WTF_USE_ALLOCATOR(Deque, Allocator);
48 public: 48 public:
49 typedef DequeIterator<T, inlineCapacity, Allocator> iterator; 49 typedef DequeIterator<T, inlineCapacity, Allocator> iterator;
50 typedef DequeConstIterator<T, inlineCapacity, Allocator> const_iterator; 50 typedef DequeConstIterator<T, inlineCapacity, Allocator> const_iterator;
51 typedef std::reverse_iterator<iterator> reverse_iterator; 51 typedef std::reverse_iterator<iterator> reverse_iterator;
52 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 52 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
53 typedef PassTraits<T> Pass; 53 typedef PassTraits<T> Pass;
54 typedef typename PassTraits<T>::PassType PassType; 54 typedef typename PassTraits<T>::PassType PassType;
55 55
56 Deque(); 56 Deque();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 template<typename Predicate> 112 template<typename Predicate>
113 iterator findIf(Predicate&); 113 iterator findIf(Predicate&);
114 114
115 typedef int HasInlinedTraceMethodMarker; 115 typedef int HasInlinedTraceMethodMarker;
116 template<typename VisitorDispatcher> void trace(VisitorDispatcher); 116 template<typename VisitorDispatcher> void trace(VisitorDispatcher);
117 117
118 private: 118 private:
119 friend class DequeIteratorBase<T, inlineCapacity, Allocator>; 119 friend class DequeIteratorBase<T, inlineCapacity, Allocator>;
120 120
121 typedef VectorBuffer<T, inlineCapacity, Allocator> Buffer; 121 typedef VectorBuffer<T, INLINE_CAPACITY, Allocator> Buffer;
122 typedef VectorTypeOperations<T> TypeOperations; 122 typedef VectorTypeOperations<T> TypeOperations;
123 typedef DequeIteratorBase<T, inlineCapacity, Allocator> IteratorBase; 123 typedef DequeIteratorBase<T, inlineCapacity, Allocator> IteratorBase;
124 124
125 void remove(size_t position); 125 void remove(size_t position);
126 void destroyAll(); 126 void destroyAll();
127 void expandCapacityIfNeeded(); 127 void expandCapacityIfNeeded();
128 void expandCapacity(); 128 void expandCapacity();
129 129
130 Buffer m_buffer; 130 Buffer m_buffer;
131 unsigned m_start; 131 unsigned m_start;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 } 266 }
267 267
268 // Off-GC-heap deques: Destructor should be called. 268 // Off-GC-heap deques: Destructor should be called.
269 // On-GC-heap deques: Destructor should be called for inline buffers 269 // On-GC-heap deques: Destructor should be called for inline buffers
270 // (if any) but destructor shouldn't be called for vector backing since 270 // (if any) but destructor shouldn't be called for vector backing since
271 // it is managed by the traced GC heap. 271 // it is managed by the traced GC heap.
272 template<typename T, size_t inlineCapacity, typename Allocator> 272 template<typename T, size_t inlineCapacity, typename Allocator>
273 inline void Deque<T, inlineCapacity, Allocator>::finalize() 273 inline void Deque<T, inlineCapacity, Allocator>::finalize()
274 { 274 {
275 if (!inlineCapacity && !m_buffer.buffer()) 275 if (!INLINE_CAPACITY && !m_buffer.buffer())
276 return; 276 return;
277 if (!isEmpty() && !(Allocator::isGarbageCollected && m_buffer.hasOutOfLi neBuffer())) 277 if (!isEmpty() && !(Allocator::isGarbageCollected && m_buffer.hasOutOfLi neBuffer()))
278 destroyAll(); 278 destroyAll();
279 279
280 m_buffer.destruct(); 280 m_buffer.destruct();
281 } 281 }
282 282
283 // FIXME: Doesn't work if there is an inline buffer, due to crbug.com/360572 283 // FIXME: Doesn't work if there is an inline buffer, due to crbug.com/360572
284 template<typename T, size_t inlineCapacity, typename Allocator> 284 template<typename T, size_t inlineCapacity, typename Allocator>
285 inline void Deque<T, inlineCapacity, Allocator>::swap(Deque<T, 0, Allocator> & other) 285 inline void Deque<T, inlineCapacity, Allocator>::swap(Deque<T, 0, Allocator> & other)
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 struct NeedsTracing<Deque<T, N>> { 562 struct NeedsTracing<Deque<T, N>> {
563 static const bool value = false; 563 static const bool value = false;
564 }; 564 };
565 #endif 565 #endif
566 566
567 } // namespace WTF 567 } // namespace WTF
568 568
569 using WTF::Deque; 569 using WTF::Deque;
570 570
571 #endif // WTF_Deque_h 571 #endif // WTF_Deque_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698