| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 public: | 353 public: |
| 354 typedef AllocatorArg NodeAllocator; | 354 typedef AllocatorArg NodeAllocator; |
| 355 typedef ValueArg Value; | 355 typedef ValueArg Value; |
| 356 | 356 |
| 357 template <typename U> | 357 template <typename U> |
| 358 ListHashSetNode(U value) | 358 ListHashSetNode(U value) |
| 359 : ListHashSetNodeBase<ValueArg>(value) { } | 359 : ListHashSetNodeBase<ValueArg>(value) { } |
| 360 | 360 |
| 361 void* operator new(size_t, NodeAllocator* allocator) | 361 void* operator new(size_t, NodeAllocator* allocator) |
| 362 { | 362 { |
| 363 COMPILE_ASSERT(sizeof(ListHashSetNode) == sizeof(ListHashSetNodeBase
<ValueArg>), PleaseAddAnyFieldsToTheBase); | 363 static_assert(sizeof(ListHashSetNode) == sizeof(ListHashSetNodeBase<
ValueArg>), "PleaseAddAnyFieldsToTheBase"); |
| 364 return allocator->allocateNode(); | 364 return allocator->allocateNode(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void setWasAlreadyDestructed() | 367 void setWasAlreadyDestructed() |
| 368 { | 368 { |
| 369 if (NodeAllocator::isGarbageCollected && HashTraits<ValueArg>::needs
Destruction) | 369 if (NodeAllocator::isGarbageCollected && HashTraits<ValueArg>::needs
Destruction) |
| 370 this->m_prev = unlinkedNodePointer(); | 370 this->m_prev = unlinkedNodePointer(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 bool wasAlreadyDestructed() const | 373 bool wasAlreadyDestructed() const |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 { | 688 { |
| 689 m_impl.swap(other.m_impl); | 689 m_impl.swap(other.m_impl); |
| 690 std::swap(m_head, other.m_head); | 690 std::swap(m_head, other.m_head); |
| 691 std::swap(m_tail, other.m_tail); | 691 std::swap(m_tail, other.m_tail); |
| 692 this->m_allocatorProvider.swap(other.m_allocatorProvider); | 692 this->m_allocatorProvider.swap(other.m_allocatorProvider); |
| 693 } | 693 } |
| 694 | 694 |
| 695 template<typename T, size_t inlineCapacity, typename U, typename V> | 695 template<typename T, size_t inlineCapacity, typename U, typename V> |
| 696 inline void ListHashSet<T, inlineCapacity, U, V>::finalize() | 696 inline void ListHashSet<T, inlineCapacity, U, V>::finalize() |
| 697 { | 697 { |
| 698 COMPILE_ASSERT(!Allocator::isGarbageCollected, FinalizeOnHeapAllocatedLi
stHashSetShouldNeverBeCalled); | 698 static_assert(!Allocator::isGarbageCollected, "FinalizeOnHeapAllocatedLi
stHashSetShouldNeverBeCalled"); |
| 699 deleteAllNodes(); | 699 deleteAllNodes(); |
| 700 } | 700 } |
| 701 | 701 |
| 702 template<typename T, size_t inlineCapacity, typename U, typename V> | 702 template<typename T, size_t inlineCapacity, typename U, typename V> |
| 703 inline T& ListHashSet<T, inlineCapacity, U, V>::first() | 703 inline T& ListHashSet<T, inlineCapacity, U, V>::first() |
| 704 { | 704 { |
| 705 ASSERT(!isEmpty()); | 705 ASSERT(!isEmpty()); |
| 706 return m_head->m_value; | 706 return m_head->m_value; |
| 707 } | 707 } |
| 708 | 708 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 if (!m_head) | 989 if (!m_head) |
| 990 return; | 990 return; |
| 991 | 991 |
| 992 for (Node* node = m_head, *next = m_head->next(); node; node = next, nex
t = node ? node->next() : 0) | 992 for (Node* node = m_head, *next = m_head->next(); node; node = next, nex
t = node ? node->next() : 0) |
| 993 node->destroy(this->allocator()); | 993 node->destroy(this->allocator()); |
| 994 } | 994 } |
| 995 | 995 |
| 996 template<typename T, size_t inlineCapacity, typename U, typename V> | 996 template<typename T, size_t inlineCapacity, typename U, typename V> |
| 997 void ListHashSet<T, inlineCapacity, U, V>::trace(typename Allocator::Visitor
* visitor) | 997 void ListHashSet<T, inlineCapacity, U, V>::trace(typename Allocator::Visitor
* visitor) |
| 998 { | 998 { |
| 999 COMPILE_ASSERT(HashTraits<T>::weakHandlingFlag == NoWeakHandlingInCollec
tions, ListHashSetDoesNotSupportWeakness); | 999 static_assert(HashTraits<T>::weakHandlingFlag == NoWeakHandlingInCollect
ions, "ListHashSetDoesNotSupportWeakness"); |
| 1000 // This marks all the nodes and their contents live that can be | 1000 // This marks all the nodes and their contents live that can be |
| 1001 // accessed through the HashTable. That includes m_head and m_tail | 1001 // accessed through the HashTable. That includes m_head and m_tail |
| 1002 // so we do not have to explicitly trace them here. | 1002 // so we do not have to explicitly trace them here. |
| 1003 m_impl.trace(visitor); | 1003 m_impl.trace(visitor); |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 #if !ENABLE(OILPAN) | 1006 #if !ENABLE(OILPAN) |
| 1007 template<typename T, size_t U, typename V> | 1007 template<typename T, size_t U, typename V> |
| 1008 struct NeedsTracing<ListHashSet<T, U, V> > { | 1008 struct NeedsTracing<ListHashSet<T, U, V> > { |
| 1009 static const bool value = false; | 1009 static const bool value = false; |
| 1010 }; | 1010 }; |
| 1011 #endif | 1011 #endif |
| 1012 | 1012 |
| 1013 } // namespace WTF | 1013 } // namespace WTF |
| 1014 | 1014 |
| 1015 using WTF::ListHashSet; | 1015 using WTF::ListHashSet; |
| 1016 | 1016 |
| 1017 #endif /* WTF_ListHashSet_h */ | 1017 #endif /* WTF_ListHashSet_h */ |
| OLD | NEW |