Index: third_party/WebKit/Source/platform/wtf/HashTable.h |
diff --git a/third_party/WebKit/Source/platform/wtf/HashTable.h b/third_party/WebKit/Source/platform/wtf/HashTable.h |
index 041cdcec3b0daabbabdbf43362909d2b788bb195..c05985b57f873d45a9c4c09dd4aa0b3633b90402 100644 |
--- a/third_party/WebKit/Source/platform/wtf/HashTable.h |
+++ b/third_party/WebKit/Source/platform/wtf/HashTable.h |
@@ -792,6 +792,10 @@ class HashTable final |
void leaveAccessForbiddenScope() { m_accessForbidden = false; } |
bool accessForbidden() const { return m_accessForbidden; } |
int64_t modifications() const { return m_modifications; } |
+ void checkCreationThread() const { |
+ DCHECK(!Allocator::isGarbageCollected || |
+ m_creationThread == currentThread()); |
+ } |
void registerModification() { m_modifications++; } |
// HashTable and collections that build on it do not support modifications |
// while there is an iterator in use. The exception is ListHashSet, which |
@@ -894,6 +898,7 @@ class HashTable final |
unsigned m_queueFlag : 1; |
unsigned m_accessForbidden : 1; |
unsigned m_modifications; |
+ ThreadIdentifier m_creationThread; |
#else |
unsigned m_deletedCount : 31; |
unsigned m_queueFlag : 1; |
@@ -949,6 +954,10 @@ inline HashTable<Key, |
m_stats(nullptr) |
#endif |
{ |
+#if DCHECK_IS_ON() |
+ if (Allocator::isGarbageCollected) |
+ m_creationThread = currentThread(); |
+#endif |
static_assert(Allocator::isGarbageCollected || |
(!IsPointerToGarbageCollectedType<Key>::value && |
!IsPointerToGarbageCollectedType<Value>::value), |
@@ -1230,6 +1239,7 @@ typename HashTable<Key, |
Allocator>::AddResult |
HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: |
add(T&& key, Extra&& extra) { |
+ checkCreationThread(); |
DCHECK(!accessForbidden()); |
DCHECK(Allocator::isAllocationAllowed()); |
if (!m_table) |
@@ -1827,6 +1837,10 @@ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: |
m_stats(HashTableStatsPtr<Allocator>::copy(other.m_stats)) |
#endif |
{ |
+#if DCHECK_IS_ON() |
+ if (Allocator::isGarbageCollected) |
+ m_creationThread = currentThread(); |
+#endif |
if (other.size()) |
reserveCapacityForSize(other.size()); |
// Copy the hash table the dumb way, by adding each element to the new |
@@ -1860,6 +1874,10 @@ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>:: |
m_stats(HashTableStatsPtr<Allocator>::copy(other.m_stats)) |
#endif |
{ |
+#if DCHECK_IS_ON() |
+ if (Allocator::isGarbageCollected) |
+ m_creationThread = currentThread(); |
+#endif |
swap(other); |
} |