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

Unified Diff: third_party/WebKit/Source/platform/wtf/Vector.h

Issue 2778993002: HashTable check
Patch Set: fix Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/HashTable.h ('k') | third_party/WebKit/Source/wtf/SizeLimits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/HashTable.h ('k') | third_party/WebKit/Source/wtf/SizeLimits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698