| 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) 2011, Benjamin Poulain <ikipou@gmail.com> | 3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> |
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void remove(ValuePeekInType value) { return remove(find(value)); } | 178 void remove(ValuePeekInType value) { return remove(find(value)); } |
| 179 void remove(iterator); | 179 void remove(iterator); |
| 180 void clear(); | 180 void clear(); |
| 181 template<typename Collection> | 181 template<typename Collection> |
| 182 void removeAll(const Collection& other) { WTF::removeAll(*this, other);
} | 182 void removeAll(const Collection& other) { WTF::removeAll(*this, other);
} |
| 183 | 183 |
| 184 ValuePassOutType take(iterator); | 184 ValuePassOutType take(iterator); |
| 185 ValuePassOutType take(ValuePeekInType); | 185 ValuePassOutType take(ValuePeekInType); |
| 186 ValuePassOutType takeFirst(); | 186 ValuePassOutType takeFirst(); |
| 187 | 187 |
| 188 void trace(typename Allocator::Visitor*); | |
| 189 | |
| 190 private: | 188 private: |
| 191 void unlink(Node*); | 189 void unlink(Node*); |
| 192 void unlinkAndDelete(Node*); | 190 void unlinkAndDelete(Node*); |
| 193 void appendNode(Node*); | 191 void appendNode(Node*); |
| 194 void prependNode(Node*); | 192 void prependNode(Node*); |
| 195 void insertNodeBefore(Node* beforeNode, Node* newNode); | 193 void insertNodeBefore(Node* beforeNode, Node* newNode); |
| 196 void deleteAllNodes(); | 194 void deleteAllNodes(); |
| 197 Allocator* allocator() const { return this->m_allocatorProvider.get(); } | 195 Allocator* allocator() const { return this->m_allocatorProvider.get(); } |
| 198 void createAllocatorIfNeeded() { this->m_allocatorProvider.createAllocat
orIfNeeded(); } | 196 void createAllocatorIfNeeded() { this->m_allocatorProvider.createAllocat
orIfNeeded(); } |
| 199 void deallocate(Node* node) const { this->m_allocatorProvider.deallocate
(node); } | 197 void deallocate(Node* node) const { this->m_allocatorProvider.deallocate
(node); } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 321 } |
| 324 | 322 |
| 325 fastFree(node); | 323 fastFree(node); |
| 326 } | 324 } |
| 327 | 325 |
| 328 bool inPool(Node* node) | 326 bool inPool(Node* node) |
| 329 { | 327 { |
| 330 return node >= pool() && node < pastPool(); | 328 return node >= pool() && node < pastPool(); |
| 331 } | 329 } |
| 332 | 330 |
| 333 static void traceValue(typename DefaultAllocator::Visitor* visitor, Node
* node) { } | |
| 334 | |
| 335 private: | 331 private: |
| 336 Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.buffer); } | 332 Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.buffer); } |
| 337 Node* pastPool() { return pool() + m_poolSize; } | 333 Node* pastPool() { return pool() + m_poolSize; } |
| 338 | 334 |
| 339 Node* m_freeList; | 335 Node* m_freeList; |
| 340 bool m_isDoneWithInitialFreeList; | 336 bool m_isDoneWithInitialFreeList; |
| 341 #if defined(MEMORY_SANITIZER_INITIAL_SIZE) | 337 #if defined(MEMORY_SANITIZER_INITIAL_SIZE) |
| 342 // The allocation pool for nodes is one big chunk that ASAN has no | 338 // The allocation pool for nodes is one big chunk that ASAN has no |
| 343 // insight into, so it can cloak errors. Make it as small as possible | 339 // insight into, so it can cloak errors. Make it as small as possible |
| 344 // to force nodes to be allocated individually where ASAN can see them. | 340 // to force nodes to be allocated individually where ASAN can see them. |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 template<typename T, size_t inlineCapacity, typename U, typename V> | 962 template<typename T, size_t inlineCapacity, typename U, typename V> |
| 967 void ListHashSet<T, inlineCapacity, U, V>::deleteAllNodes() | 963 void ListHashSet<T, inlineCapacity, U, V>::deleteAllNodes() |
| 968 { | 964 { |
| 969 if (!m_head) | 965 if (!m_head) |
| 970 return; | 966 return; |
| 971 | 967 |
| 972 for (Node* node = m_head, *next = m_head->next(); node; node = next, nex
t = node ? node->next() : 0) | 968 for (Node* node = m_head, *next = m_head->next(); node; node = next, nex
t = node ? node->next() : 0) |
| 973 node->destroy(this->allocator()); | 969 node->destroy(this->allocator()); |
| 974 } | 970 } |
| 975 | 971 |
| 976 template<typename T, size_t inlineCapacity, typename U, typename V> | |
| 977 void ListHashSet<T, inlineCapacity, U, V>::trace(typename Allocator::Visitor
* visitor) | |
| 978 { | |
| 979 COMPILE_ASSERT(HashTraits<T>::weakHandlingFlag == NoWeakHandlingInCollec
tions, ListHashSetDoesNotSupportWeakness); | |
| 980 // This marks all the nodes and their contents live that can be | |
| 981 // accessed through the HashTable. That includes m_head and m_tail | |
| 982 // so we do not have to explicitly trace them here. | |
| 983 m_impl.trace(visitor); | |
| 984 } | |
| 985 | |
| 986 #if !ENABLE(OILPAN) | |
| 987 template<typename T, size_t U, typename V> | |
| 988 struct NeedsTracing<ListHashSet<T, U, V> > { | |
| 989 static const bool value = false; | |
| 990 }; | |
| 991 #endif | |
| 992 | |
| 993 } // namespace WTF | 972 } // namespace WTF |
| 994 | 973 |
| 995 using WTF::ListHashSet; | 974 using WTF::ListHashSet; |
| 996 | 975 |
| 997 #endif /* WTF_ListHashSet_h */ | 976 #endif /* WTF_ListHashSet_h */ |
| OLD | NEW |