| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // slot and get the right answer. | 288 // slot and get the right answer. |
| 289 static const bool safeToCompareToEmptyOrDeleted = false; | 289 static const bool safeToCompareToEmptyOrDeleted = false; |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 template<typename Value, typename Allocator> | 292 template<typename Value, typename Allocator> |
| 293 struct LinkedHashSetExtractor { | 293 struct LinkedHashSetExtractor { |
| 294 static const Value& extract(const LinkedHashSetNode<Value, Allocator>& node)
{ return node.m_value; } | 294 static const Value& extract(const LinkedHashSetNode<Value, Allocator>& node)
{ return node.m_value; } |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 template<typename Value, typename ValueTraitsArg, typename Allocator> | 297 template<typename Value, typename ValueTraitsArg, typename Allocator> |
| 298 struct LinkedHashSetTraits : public SimpleClassHashTraits<LinkedHashSetNode<Valu
e, Allocator> > { | 298 struct LinkedHashSetTraits : public SimpleClassHashTraits<LinkedHashSetNode<Valu
e, Allocator>> { |
| 299 typedef LinkedHashSetNode<Value, Allocator> Node; | 299 typedef LinkedHashSetNode<Value, Allocator> Node; |
| 300 typedef ValueTraitsArg ValueTraits; | 300 typedef ValueTraitsArg ValueTraits; |
| 301 | 301 |
| 302 // The slot is empty when the m_next field is zero so it's safe to zero | 302 // The slot is empty when the m_next field is zero so it's safe to zero |
| 303 // the backing. | 303 // the backing. |
| 304 static const bool emptyValueIsZero = true; | 304 static const bool emptyValueIsZero = true; |
| 305 | 305 |
| 306 static const bool hasIsEmptyValueFunction = true; | 306 static const bool hasIsEmptyValueFunction = true; |
| 307 static bool isEmptyValue(const Node& node) { return !node.m_next; } | 307 static bool isEmptyValue(const Node& node) { return !node.m_next; } |
| 308 | 308 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 const LinkedHashSet::Node* node = m_impl.template lookup<TranslatedFunctions
, const T&>(value); | 594 const LinkedHashSet::Node* node = m_impl.template lookup<TranslatedFunctions
, const T&>(value); |
| 595 if (!node) | 595 if (!node) |
| 596 return end(); | 596 return end(); |
| 597 return makeConstIterator(node); | 597 return makeConstIterator(node); |
| 598 } | 598 } |
| 599 | 599 |
| 600 template<typename Value, typename U, typename V, typename W> | 600 template<typename Value, typename U, typename V, typename W> |
| 601 template<typename HashTranslator, typename T> | 601 template<typename HashTranslator, typename T> |
| 602 inline bool LinkedHashSet<Value, U, V, W>::contains(const T& value) const | 602 inline bool LinkedHashSet<Value, U, V, W>::contains(const T& value) const |
| 603 { | 603 { |
| 604 return m_impl.template contains<LinkedHashSetTranslatorAdapter<HashTranslato
r> >(value); | 604 return m_impl.template contains<LinkedHashSetTranslatorAdapter<HashTranslato
r>>(value); |
| 605 } | 605 } |
| 606 | 606 |
| 607 template<typename T, typename U, typename V, typename W> | 607 template<typename T, typename U, typename V, typename W> |
| 608 inline bool LinkedHashSet<T, U, V, W>::contains(ValuePeekInType value) const | 608 inline bool LinkedHashSet<T, U, V, W>::contains(ValuePeekInType value) const |
| 609 { | 609 { |
| 610 return m_impl.template contains<NodeHashFunctions>(value); | 610 return m_impl.template contains<NodeHashFunctions>(value); |
| 611 } | 611 } |
| 612 | 612 |
| 613 template<typename Value, typename HashFunctions, typename Traits, typename Alloc
ator> | 613 template<typename Value, typename HashFunctions, typename Traits, typename Alloc
ator> |
| 614 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult Linke
dHashSet<Value, HashFunctions, Traits, Allocator>::add(ValuePeekInType value) | 614 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult Linke
dHashSet<Value, HashFunctions, Traits, Allocator>::add(ValuePeekInType value) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 void deleteAllValues(const LinkedHashSet<ValueType, T, U>& set) | 722 void deleteAllValues(const LinkedHashSet<ValueType, T, U>& set) |
| 723 { | 723 { |
| 724 typedef typename LinkedHashSet<ValueType, T, U>::const_iterator iterator; | 724 typedef typename LinkedHashSet<ValueType, T, U>::const_iterator iterator; |
| 725 iterator end = set.end(); | 725 iterator end = set.end(); |
| 726 for (iterator it = set.begin(); it != end; ++it) | 726 for (iterator it = set.begin(); it != end; ++it) |
| 727 delete *it; | 727 delete *it; |
| 728 } | 728 } |
| 729 | 729 |
| 730 #if !ENABLE(OILPAN) | 730 #if !ENABLE(OILPAN) |
| 731 template<typename T, typename U, typename V> | 731 template<typename T, typename U, typename V> |
| 732 struct NeedsTracing<LinkedHashSet<T, U, V> > { | 732 struct NeedsTracing<LinkedHashSet<T, U, V>> { |
| 733 static const bool value = false; | 733 static const bool value = false; |
| 734 }; | 734 }; |
| 735 #endif | 735 #endif |
| 736 | 736 |
| 737 } | 737 } |
| 738 | 738 |
| 739 using WTF::LinkedHashSet; | 739 using WTF::LinkedHashSet; |
| 740 | 740 |
| 741 #endif /* WTF_LinkedHashSet_h */ | 741 #endif /* WTF_LinkedHashSet_h */ |
| OLD | NEW |