| Index: Source/wtf/Vector.h
|
| diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h
|
| index 15d15e3bc9070821b743abd0231669f26ab4b277..f79f116a567af54c3ed5928594e09bfb70242670 100644
|
| --- a/Source/wtf/Vector.h
|
| +++ b/Source/wtf/Vector.h
|
| @@ -32,6 +32,7 @@
|
| #include "wtf/VectorTraits.h"
|
| #include <algorithm>
|
| #include <iterator>
|
| +#include <stdio.h>
|
| #include <string.h>
|
| #include <utility>
|
|
|
| @@ -319,9 +320,9 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
|
| ASSERT(newCapacity);
|
| size_t sizeToAllocate = allocationSize(newCapacity);
|
| if (hasInlineCapacity)
|
| - m_buffer = Allocator::template allocateInlineVectorBacking<T>(sizeToAllocate);
|
| + m_buffer = Allocator::template allocateInlineVectorBacking<T>(sizeToAllocate, this);
|
| else
|
| - m_buffer = Allocator::template allocateVectorBacking<T>(sizeToAllocate);
|
| + m_buffer = Allocator::template allocateVectorBacking<T>(sizeToAllocate, this);
|
| m_capacity = sizeToAllocate / sizeof(T);
|
| }
|
|
|
| @@ -330,15 +331,15 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
|
| ASSERT(newCapacity);
|
| size_t sizeToAllocate = allocationSize(newCapacity);
|
| if (hasInlineCapacity)
|
| - m_buffer = Allocator::template allocateInlineVectorBacking<T>(sizeToAllocate);
|
| + m_buffer = Allocator::template allocateInlineVectorBacking<T>(sizeToAllocate, this);
|
| else
|
| - m_buffer = Allocator::template allocateExpandedVectorBacking<T>(sizeToAllocate);
|
| + m_buffer = Allocator::template allocateExpandedVectorBacking<T>(sizeToAllocate, this);
|
| m_capacity = sizeToAllocate / sizeof(T);
|
| }
|
|
|
| size_t allocationSize(size_t capacity) const
|
| {
|
| - return Allocator::template quantizedSize<T>(capacity);
|
| + return Allocator::template quantizedSize(capacity, sizeof(T));
|
| }
|
|
|
| T* buffer() { return m_buffer; }
|
| @@ -413,7 +414,7 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
|
| bool expandBuffer(size_t newCapacity)
|
| {
|
| size_t sizeToAllocate = allocationSize(newCapacity);
|
| - if (Allocator::expandVectorBacking(m_buffer, sizeToAllocate)) {
|
| + if (Allocator::expandVectorBacking(m_buffer, sizeToAllocate + 16)) {
|
| m_capacity = sizeToAllocate / sizeof(T);
|
| return true;
|
| }
|
| @@ -1050,10 +1051,7 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
|
| #ifdef ANNOTATE_CONTIGUOUS_CONTAINER
|
| size_t oldCapacity = capacity();
|
| #endif
|
| - // The Allocator::isGarbageCollected check is not needed.
|
| - // The check is just a static hint for a compiler to indicate that
|
| - // Base::expandBuffer returns false if Allocator is a DefaultAllocator.
|
| - if (Allocator::isGarbageCollected && Base::expandBuffer(newCapacity)) {
|
| + if (Base::expandBuffer(newCapacity)) {
|
| ANNOTATE_CHANGE_CAPACITY(begin(), oldCapacity, m_size, capacity());
|
| return;
|
| }
|
|
|