Index: third_party/WebKit/Source/platform/wtf/Vector.h |
diff --git a/third_party/WebKit/Source/platform/wtf/Vector.h b/third_party/WebKit/Source/platform/wtf/Vector.h |
index 76280a3cd3c77ba13574f6584f3b5565b435cc03..dc82822bd164c26224694aa9209bf8cfc88d2ff2 100644 |
--- a/third_party/WebKit/Source/platform/wtf/Vector.h |
+++ b/third_party/WebKit/Source/platform/wtf/Vector.h |
@@ -360,6 +360,7 @@ class VectorBufferBase { |
public: |
void allocateBuffer(size_t newCapacity) { |
+ checkCreationThread(); |
DCHECK(newCapacity); |
DCHECK_LE(newCapacity, |
Allocator::template maxElementCountInBackingStore<T>()); |
@@ -425,14 +426,30 @@ class VectorBufferBase { |
}; |
protected: |
- VectorBufferBase() : m_buffer(nullptr), m_capacity(0) {} |
+ VectorBufferBase() : m_buffer(nullptr), m_capacity(0) { |
+ if (Allocator::isGarbageCollected) |
+ m_creationThread = currentThread(); |
+ } |
VectorBufferBase(T* buffer, size_t capacity) |
- : m_buffer(buffer), m_capacity(capacity) {} |
+ : m_buffer(buffer), m_capacity(capacity) { |
+ if (Allocator::isGarbageCollected) |
+ m_creationThread = currentThread(); |
+ } |
+ |
+#if DCHECK_IS_ON() |
+ void checkCreationThread() const { |
+ DCHECK(!Allocator::isGarbageCollected || |
+ m_creationThread == currentThread()); |
+ } |
+#endif |
T* m_buffer; |
unsigned m_capacity; |
unsigned m_size; |
+#if DCHECK_IS_ON() |
+ ThreadIdentifier m_creationThread; |
+#endif |
}; |
template <typename T, |