| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008 David Levin <levin@chromium.org> | 3 * Copyright (C) 2008 David Levin <levin@chromium.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 --m_position; | 126 --m_position; |
| 127 } | 127 } |
| 128 | 128 |
| 129 HashTableConstIterator(const HashTableType* table, PointerType position,
PointerType endPosition, IteratorWitnessType witness) | 129 HashTableConstIterator(const HashTableType* table, PointerType position,
PointerType endPosition, IteratorWitnessType witness) |
| 130 : m_position(position) | 130 : m_position(position) |
| 131 , m_endPosition(endPosition) | 131 , m_endPosition(endPosition) |
| 132 #if CHECK_HASHTABLE_ITERATORS | 132 #if CHECK_HASHTABLE_ITERATORS |
| 133 , m_witness(witness) | 133 , m_witness(witness) |
| 134 #endif | 134 #endif |
| 135 { | 135 { |
| 136 Allocator::template IteratorWitness<HashTableType>::verify(witness,
table); | 136 Allocator::template IteratorWitness<HashTableType>::verifyWitness(wi
tness, table); |
| 137 addIterator(table, this); | 137 addIterator(table, this); |
| 138 skipEmptyBuckets(); | 138 skipEmptyBuckets(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 HashTableConstIterator(const HashTableType* table, PointerType position,
PointerType endPosition, HashItemKnownGoodTag, IteratorWitnessType witness) | 141 HashTableConstIterator(const HashTableType* table, PointerType position,
PointerType endPosition, HashItemKnownGoodTag, IteratorWitnessType witness) |
| 142 : m_position(position) | 142 : m_position(position) |
| 143 , m_endPosition(endPosition) | 143 , m_endPosition(endPosition) |
| 144 #if CHECK_HASHTABLE_ITERATORS | 144 #if CHECK_HASHTABLE_ITERATORS |
| 145 , m_witness(witness) | 145 , m_witness(witness) |
| 146 #endif | 146 #endif |
| 147 { | 147 { |
| 148 Allocator::template IteratorWitness<HashTableType>::verify(witness,
table); | 148 Allocator::template IteratorWitness<HashTableType>::verifyWitness(wi
tness, table); |
| 149 addIterator(table, this); | 149 addIterator(table, this); |
| 150 } | 150 } |
| 151 | 151 |
| 152 public: | 152 public: |
| 153 HashTableConstIterator() | 153 HashTableConstIterator() |
| 154 #if CHECK_HASHTABLE_ITERATORS | 154 #if CHECK_HASHTABLE_ITERATORS |
| 155 : m_witness(0) | 155 : m_witness(0) |
| 156 #endif | 156 #endif |
| 157 { | 157 { |
| 158 addIterator(static_cast<const HashTableType*>(0), this); | 158 addIterator(static_cast<const HashTableType*>(0), this); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 bool operator!=(const iterator& other) const | 229 bool operator!=(const iterator& other) const |
| 230 { | 230 { |
| 231 return *this != static_cast<const_iterator>(other); | 231 return *this != static_cast<const_iterator>(other); |
| 232 } | 232 } |
| 233 | 233 |
| 234 private: | 234 private: |
| 235 void checkValidity() const | 235 void checkValidity() const |
| 236 { | 236 { |
| 237 #if CHECK_HASHTABLE_ITERATORS | 237 #if CHECK_HASHTABLE_ITERATORS |
| 238 ASSERT(m_table); | 238 ASSERT(m_table); |
| 239 Allocator::template IteratorWitness<HashTableType>::verify(m_witness
, m_table); | 239 Allocator::template IteratorWitness<HashTableType>::verifyWitness(m_
witness, m_table); |
| 240 #endif | 240 #endif |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 #if CHECK_HASHTABLE_ITERATORS | 244 #if CHECK_HASHTABLE_ITERATORS |
| 245 void checkValidity(const const_iterator& other) const | 245 void checkValidity(const const_iterator& other) const |
| 246 { | 246 { |
| 247 ASSERT(m_table); | 247 ASSERT(m_table); |
| 248 Allocator::template IteratorWitness<HashTableType>::verify(m_witness
, m_table); | 248 Allocator::template IteratorWitness<HashTableType>::verifyWitness(m_
witness, m_table); |
| 249 ASSERT_UNUSED(other, other.m_table); | 249 ASSERT_UNUSED(other, other.m_table); |
| 250 ASSERT(m_table == other.m_table); | 250 ASSERT(m_table == other.m_table); |
| 251 } | 251 } |
| 252 #else | 252 #else |
| 253 void checkValidity(const const_iterator&) const { } | 253 void checkValidity(const const_iterator&) const { } |
| 254 #endif | 254 #endif |
| 255 | 255 |
| 256 PointerType m_position; | 256 PointerType m_position; |
| 257 PointerType m_endPosition; | 257 PointerType m_endPosition; |
| 258 | 258 |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 { | 1398 { |
| 1399 typedef HashTable<T, U, V, W, X, Y, Allocator> HashTableType; | 1399 typedef HashTable<T, U, V, W, X, Y, Allocator> HashTableType; |
| 1400 typedef HashTableConstIterator<T, U, V, W, X, Y, Allocator> const_iterat
or; | 1400 typedef HashTableConstIterator<T, U, V, W, X, Y, Allocator> const_iterat
or; |
| 1401 | 1401 |
| 1402 | 1402 |
| 1403 // Delete iterator from doubly-linked list of iterators. | 1403 // Delete iterator from doubly-linked list of iterators. |
| 1404 if (!it->m_table) { | 1404 if (!it->m_table) { |
| 1405 ASSERT(!it->m_next); | 1405 ASSERT(!it->m_next); |
| 1406 ASSERT(!it->m_previous); | 1406 ASSERT(!it->m_previous); |
| 1407 } else { | 1407 } else { |
| 1408 Allocator::template IteratorWitness<HashTableType>::verify(it->m_wit
ness, it->m_table); | 1408 Allocator::template IteratorWitness<HashTableType>::verifyWitness(it
->m_witness, it->m_table); |
| 1409 MutexLocker lock(*it->m_table->m_mutex); | 1409 MutexLocker lock(*it->m_table->m_mutex); |
| 1410 if (it->m_next) { | 1410 if (it->m_next) { |
| 1411 ASSERT(it->m_next->m_previous == it); | 1411 ASSERT(it->m_next->m_previous == it); |
| 1412 it->m_next->m_previous = it->m_previous; | 1412 it->m_next->m_previous = it->m_previous; |
| 1413 } | 1413 } |
| 1414 if (it->m_previous) { | 1414 if (it->m_previous) { |
| 1415 ASSERT(it->m_table->m_iterators != it); | 1415 ASSERT(it->m_table->m_iterators != it); |
| 1416 ASSERT(it->m_previous->m_next == it); | 1416 ASSERT(it->m_previous->m_next == it); |
| 1417 it->m_previous->m_next = it->m_next; | 1417 it->m_previous->m_next = it->m_next; |
| 1418 } else { | 1418 } else { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTa
bleConstIteratorAdapter<T, U>& b) | 1516 inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTa
bleConstIteratorAdapter<T, U>& b) |
| 1517 { | 1517 { |
| 1518 return a.m_impl != b.m_impl; | 1518 return a.m_impl != b.m_impl; |
| 1519 } | 1519 } |
| 1520 | 1520 |
| 1521 } // namespace WTF | 1521 } // namespace WTF |
| 1522 | 1522 |
| 1523 #include <wtf/HashIterators.h> | 1523 #include <wtf/HashIterators.h> |
| 1524 | 1524 |
| 1525 #endif // WTF_HashTable_h | 1525 #endif // WTF_HashTable_h |
| OLD | NEW |