OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 { | 302 { |
303 return Allocator::Quantizer::template quantizedSize<T>(capacity); | 303 return Allocator::Quantizer::template quantizedSize<T>(capacity); |
304 } | 304 } |
305 | 305 |
306 T* buffer() { return m_buffer; } | 306 T* buffer() { return m_buffer; } |
307 const T* buffer() const { return m_buffer; } | 307 const T* buffer() const { return m_buffer; } |
308 size_t capacity() const { return m_capacity; } | 308 size_t capacity() const { return m_capacity; } |
309 | 309 |
310 void clearUnusedSlots(T* from, T* to) | 310 void clearUnusedSlots(T* from, T* to) |
311 { | 311 { |
312 VectorUnusedSlotClearer<Allocator::isGarbageCollected && (VectorTrai
ts<T>::needsDestruction || ShouldBeTraced<VectorTraits<T> >::value), T>::clear(f
rom, to); | 312 VectorUnusedSlotClearer<Allocator::isGarbageCollected && (VectorTrai
ts<T>::needsDestruction || ShouldBeTraced<VectorTraits<T>>::value), T>::clear(fr
om, to); |
313 } | 313 } |
314 | 314 |
315 protected: | 315 protected: |
316 VectorBufferBase() | 316 VectorBufferBase() |
317 : m_buffer(0) | 317 : m_buffer(0) |
318 , m_capacity(0) | 318 , m_capacity(0) |
319 { | 319 { |
320 } | 320 } |
321 | 321 |
322 VectorBufferBase(T* buffer, size_t capacity) | 322 VectorBufferBase(T* buffer, size_t capacity) |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 | 1209 |
1210 // This is only called if the allocator is a HeapAllocator. It is used when | 1210 // This is only called if the allocator is a HeapAllocator. It is used when |
1211 // visiting during a tracing GC. | 1211 // visiting during a tracing GC. |
1212 template<typename T, size_t inlineCapacity, typename Allocator> | 1212 template<typename T, size_t inlineCapacity, typename Allocator> |
1213 template<typename VisitorDispatcher> | 1213 template<typename VisitorDispatcher> |
1214 void Vector<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor) | 1214 void Vector<T, inlineCapacity, Allocator>::trace(VisitorDispatcher visitor) |
1215 { | 1215 { |
1216 ASSERT(Allocator::isGarbageCollected); // Garbage collector must be enab
led. | 1216 ASSERT(Allocator::isGarbageCollected); // Garbage collector must be enab
led. |
1217 const T* bufferBegin = buffer(); | 1217 const T* bufferBegin = buffer(); |
1218 const T* bufferEnd = buffer() + size(); | 1218 const T* bufferEnd = buffer() + size(); |
1219 if (ShouldBeTraced<VectorTraits<T> >::value) { | 1219 if (ShouldBeTraced<VectorTraits<T>>::value) { |
1220 for (const T* bufferEntry = bufferBegin; bufferEntry != bufferEnd; b
ufferEntry++) | 1220 for (const T* bufferEntry = bufferBegin; bufferEntry != bufferEnd; b
ufferEntry++) |
1221 Allocator::template trace<VisitorDispatcher, T, VectorTraits<T>
>(visitor, *const_cast<T*>(bufferEntry)); | 1221 Allocator::template trace<VisitorDispatcher, T, VectorTraits<T>>
(visitor, *const_cast<T*>(bufferEntry)); |
1222 } | 1222 } |
1223 if (this->hasOutOfLineBuffer()) | 1223 if (this->hasOutOfLineBuffer()) |
1224 Allocator::markNoTracing(visitor, buffer()); | 1224 Allocator::markNoTracing(visitor, buffer()); |
1225 } | 1225 } |
1226 | 1226 |
1227 #if !ENABLE(OILPAN) | 1227 #if !ENABLE(OILPAN) |
1228 template<typename T, size_t N> | 1228 template<typename T, size_t N> |
1229 struct NeedsTracing<Vector<T, N> > { | 1229 struct NeedsTracing<Vector<T, N>> { |
1230 static const bool value = false; | 1230 static const bool value = false; |
1231 }; | 1231 }; |
1232 #endif | 1232 #endif |
1233 | 1233 |
1234 } // namespace WTF | 1234 } // namespace WTF |
1235 | 1235 |
1236 using WTF::Vector; | 1236 using WTF::Vector; |
1237 | 1237 |
1238 #endif // WTF_Vector_h | 1238 #endif // WTF_Vector_h |
OLD | NEW |