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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 37 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
38 static const size_t kInitialVectorSize = 1; | 38 static const size_t kInitialVectorSize = 1; |
39 #else | 39 #else |
40 #ifndef WTF_VECTOR_INITIAL_SIZE | 40 #ifndef WTF_VECTOR_INITIAL_SIZE |
41 #define WTF_VECTOR_INITIAL_SIZE 4 | 41 #define WTF_VECTOR_INITIAL_SIZE 4 |
42 #endif | 42 #endif |
43 static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE; | 43 static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE; |
44 #endif | 44 #endif |
45 | 45 |
| 46 template<typename T, size_t inlineBuffer, typename Allocator> |
| 47 class Deque; |
| 48 |
46 template <bool needsDestruction, typename T> | 49 template <bool needsDestruction, typename T> |
47 struct VectorDestructor; | 50 struct VectorDestructor; |
48 | 51 |
49 template<typename T> | 52 template<typename T> |
50 struct VectorDestructor<false, T> | 53 struct VectorDestructor<false, T> |
51 { | 54 { |
52 static void destruct(T*, T*) {} | 55 static void destruct(T*, T*) {} |
53 }; | 56 }; |
54 | 57 |
55 template<typename T> | 58 template<typename T> |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 490 |
488 private: | 491 private: |
489 using Base::m_buffer; | 492 using Base::m_buffer; |
490 using Base::m_capacity; | 493 using Base::m_capacity; |
491 | 494 |
492 static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); | 495 static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); |
493 T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer.buffe
r); } | 496 T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer.buffe
r); } |
494 const T* inlineBuffer() const { return reinterpret_cast_ptr<const T*>(m_
inlineBuffer.buffer); } | 497 const T* inlineBuffer() const { return reinterpret_cast_ptr<const T*>(m_
inlineBuffer.buffer); } |
495 | 498 |
496 AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer; | 499 AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer; |
| 500 template<typename U, size_t inlineBuffer, typename V> |
| 501 friend class Deque; |
497 }; | 502 }; |
498 | 503 |
499 template<typename T, size_t inlineCapacity, typename Allocator> | 504 template<typename T, size_t inlineCapacity, typename Allocator> |
500 class Vector; | 505 class Vector; |
501 | 506 |
502 // VectorDestructorBase defines the destructor of a vector. This base is use
d in order to | 507 // VectorDestructorBase defines the destructor of a vector. This base is use
d in order to |
503 // completely avoid creating a destructor for a vector that does not need to
be destructed. | 508 // completely avoid creating a destructor for a vector that does not need to
be destructed. |
504 // By doing so, the clang compiler will have correct information about wheth
er or not a | 509 // By doing so, the clang compiler will have correct information about wheth
er or not a |
505 // vector has a trivial destructor and we use that in a compiler plugin to e
nsure the | 510 // vector has a trivial destructor and we use that in a compiler plugin to e
nsure the |
506 // correctness of non-finalized garbage-collected classes and the use of Vec
torTraits::needsDestruction. | 511 // correctness of non-finalized garbage-collected classes and the use of Vec
torTraits::needsDestruction. |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 } | 1194 } |
1190 if (this->hasOutOfLineBuffer()) | 1195 if (this->hasOutOfLineBuffer()) |
1191 Allocator::markNoTracing(visitor, buffer()); | 1196 Allocator::markNoTracing(visitor, buffer()); |
1192 } | 1197 } |
1193 | 1198 |
1194 } // namespace WTF | 1199 } // namespace WTF |
1195 | 1200 |
1196 using WTF::Vector; | 1201 using WTF::Vector; |
1197 | 1202 |
1198 #endif // WTF_Vector_h | 1203 #endif // WTF_Vector_h |
OLD | NEW |