| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> | 4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 template <typename T, size_t inlineCapacity, typename U, typename V> | 916 template <typename T, size_t inlineCapacity, typename U, typename V> |
| 917 template <typename IncomingValueType> | 917 template <typename IncomingValueType> |
| 918 typename ListHashSet<T, inlineCapacity, U, V>::AddResult | 918 typename ListHashSet<T, inlineCapacity, U, V>::AddResult |
| 919 ListHashSet<T, inlineCapacity, U, V>::insert(IncomingValueType&& value) { | 919 ListHashSet<T, inlineCapacity, U, V>::insert(IncomingValueType&& value) { |
| 920 createAllocatorIfNeeded(); | 920 createAllocatorIfNeeded(); |
| 921 // The second argument is a const ref. This is useful for the HashTable | 921 // The second argument is a const ref. This is useful for the HashTable |
| 922 // because it lets it take lvalues by reference, but for our purposes it's | 922 // because it lets it take lvalues by reference, but for our purposes it's |
| 923 // inconvenient, since it constrains us to be const, whereas the allocator | 923 // inconvenient, since it constrains us to be const, whereas the allocator |
| 924 // actually changes when it does allocations. | 924 // actually changes when it does allocations. |
| 925 auto result = m_impl.template add<BaseTranslator>( | 925 auto result = m_impl.template insert<BaseTranslator>( |
| 926 std::forward<IncomingValueType>(value), *this->getAllocator()); | 926 std::forward<IncomingValueType>(value), *this->getAllocator()); |
| 927 if (result.isNewEntry) | 927 if (result.isNewEntry) |
| 928 appendNode(*result.storedValue); | 928 appendNode(*result.storedValue); |
| 929 return AddResult(*result.storedValue, result.isNewEntry); | 929 return AddResult(*result.storedValue, result.isNewEntry); |
| 930 } | 930 } |
| 931 | 931 |
| 932 template <typename T, size_t inlineCapacity, typename U, typename V> | 932 template <typename T, size_t inlineCapacity, typename U, typename V> |
| 933 template <typename IncomingValueType> | 933 template <typename IncomingValueType> |
| 934 typename ListHashSet<T, inlineCapacity, U, V>::iterator | 934 typename ListHashSet<T, inlineCapacity, U, V>::iterator |
| 935 ListHashSet<T, inlineCapacity, U, V>::addReturnIterator( | 935 ListHashSet<T, inlineCapacity, U, V>::addReturnIterator( |
| 936 IncomingValueType&& value) { | 936 IncomingValueType&& value) { |
| 937 return makeIterator(insert(std::forward<IncomingValueType>(value)).m_node); | 937 return makeIterator(insert(std::forward<IncomingValueType>(value)).m_node); |
| 938 } | 938 } |
| 939 | 939 |
| 940 template <typename T, size_t inlineCapacity, typename U, typename V> | 940 template <typename T, size_t inlineCapacity, typename U, typename V> |
| 941 template <typename IncomingValueType> | 941 template <typename IncomingValueType> |
| 942 typename ListHashSet<T, inlineCapacity, U, V>::AddResult | 942 typename ListHashSet<T, inlineCapacity, U, V>::AddResult |
| 943 ListHashSet<T, inlineCapacity, U, V>::appendOrMoveToLast( | 943 ListHashSet<T, inlineCapacity, U, V>::appendOrMoveToLast( |
| 944 IncomingValueType&& value) { | 944 IncomingValueType&& value) { |
| 945 createAllocatorIfNeeded(); | 945 createAllocatorIfNeeded(); |
| 946 auto result = m_impl.template add<BaseTranslator>( | 946 auto result = m_impl.template insert<BaseTranslator>( |
| 947 std::forward<IncomingValueType>(value), *this->getAllocator()); | 947 std::forward<IncomingValueType>(value), *this->getAllocator()); |
| 948 Node* node = *result.storedValue; | 948 Node* node = *result.storedValue; |
| 949 if (!result.isNewEntry) | 949 if (!result.isNewEntry) |
| 950 unlink(node); | 950 unlink(node); |
| 951 appendNode(node); | 951 appendNode(node); |
| 952 return AddResult(*result.storedValue, result.isNewEntry); | 952 return AddResult(*result.storedValue, result.isNewEntry); |
| 953 } | 953 } |
| 954 | 954 |
| 955 template <typename T, size_t inlineCapacity, typename U, typename V> | 955 template <typename T, size_t inlineCapacity, typename U, typename V> |
| 956 template <typename IncomingValueType> | 956 template <typename IncomingValueType> |
| 957 typename ListHashSet<T, inlineCapacity, U, V>::AddResult | 957 typename ListHashSet<T, inlineCapacity, U, V>::AddResult |
| 958 ListHashSet<T, inlineCapacity, U, V>::prependOrMoveToFirst( | 958 ListHashSet<T, inlineCapacity, U, V>::prependOrMoveToFirst( |
| 959 IncomingValueType&& value) { | 959 IncomingValueType&& value) { |
| 960 createAllocatorIfNeeded(); | 960 createAllocatorIfNeeded(); |
| 961 auto result = m_impl.template add<BaseTranslator>( | 961 auto result = m_impl.template insert<BaseTranslator>( |
| 962 std::forward<IncomingValueType>(value), *this->getAllocator()); | 962 std::forward<IncomingValueType>(value), *this->getAllocator()); |
| 963 Node* node = *result.storedValue; | 963 Node* node = *result.storedValue; |
| 964 if (!result.isNewEntry) | 964 if (!result.isNewEntry) |
| 965 unlink(node); | 965 unlink(node); |
| 966 prependNode(node); | 966 prependNode(node); |
| 967 return AddResult(*result.storedValue, result.isNewEntry); | 967 return AddResult(*result.storedValue, result.isNewEntry); |
| 968 } | 968 } |
| 969 | 969 |
| 970 template <typename T, size_t inlineCapacity, typename U, typename V> | 970 template <typename T, size_t inlineCapacity, typename U, typename V> |
| 971 template <typename IncomingValueType> | 971 template <typename IncomingValueType> |
| 972 typename ListHashSet<T, inlineCapacity, U, V>::AddResult | 972 typename ListHashSet<T, inlineCapacity, U, V>::AddResult |
| 973 ListHashSet<T, inlineCapacity, U, V>::insertBefore( | 973 ListHashSet<T, inlineCapacity, U, V>::insertBefore( |
| 974 iterator it, | 974 iterator it, |
| 975 IncomingValueType&& newValue) { | 975 IncomingValueType&& newValue) { |
| 976 createAllocatorIfNeeded(); | 976 createAllocatorIfNeeded(); |
| 977 auto result = m_impl.template add<BaseTranslator>( | 977 auto result = m_impl.template insert<BaseTranslator>( |
| 978 std::forward<IncomingValueType>(newValue), *this->getAllocator()); | 978 std::forward<IncomingValueType>(newValue), *this->getAllocator()); |
| 979 if (result.isNewEntry) | 979 if (result.isNewEntry) |
| 980 insertNodeBefore(it.getNode(), *result.storedValue); | 980 insertNodeBefore(it.getNode(), *result.storedValue); |
| 981 return AddResult(*result.storedValue, result.isNewEntry); | 981 return AddResult(*result.storedValue, result.isNewEntry); |
| 982 } | 982 } |
| 983 | 983 |
| 984 template <typename T, size_t inlineCapacity, typename U, typename V> | 984 template <typename T, size_t inlineCapacity, typename U, typename V> |
| 985 template <typename IncomingValueType> | 985 template <typename IncomingValueType> |
| 986 typename ListHashSet<T, inlineCapacity, U, V>::AddResult | 986 typename ListHashSet<T, inlineCapacity, U, V>::AddResult |
| 987 ListHashSet<T, inlineCapacity, U, V>::insertBefore( | 987 ListHashSet<T, inlineCapacity, U, V>::insertBefore( |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 // through the HashTable. That includes m_head and m_tail so we do not have | 1126 // through the HashTable. That includes m_head and m_tail so we do not have |
| 1127 // to explicitly trace them here. | 1127 // to explicitly trace them here. |
| 1128 m_impl.trace(visitor); | 1128 m_impl.trace(visitor); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 } // namespace WTF | 1131 } // namespace WTF |
| 1132 | 1132 |
| 1133 using WTF::ListHashSet; | 1133 using WTF::ListHashSet; |
| 1134 | 1134 |
| 1135 #endif // WTF_ListHashSet_h | 1135 #endif // WTF_ListHashSet_h |
| OLD | NEW |