Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/Source/platform/wtf/LinkedHashSet.h

Issue 2804953004: Migrate WTF::HashTable::add() to ::insert() (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Add the value to the beginning of the collection. If the value was already 277 // Add the value to the beginning of the collection. If the value was already
278 // in the list, it is moved to the beginning. 278 // in the list, it is moved to the beginning.
279 template <typename IncomingValueType> 279 template <typename IncomingValueType>
280 AddResult prependOrMoveToFirst(IncomingValueType&&); 280 AddResult prependOrMoveToFirst(IncomingValueType&&);
281 281
282 template <typename IncomingValueType> 282 template <typename IncomingValueType>
283 AddResult insertBefore(ValuePeekInType beforeValue, 283 AddResult insertBefore(ValuePeekInType beforeValue,
284 IncomingValueType&& newValue); 284 IncomingValueType&& newValue);
285 template <typename IncomingValueType> 285 template <typename IncomingValueType>
286 AddResult insertBefore(iterator it, IncomingValueType&& newValue) { 286 AddResult insertBefore(iterator it, IncomingValueType&& newValue) {
287 return m_impl.template add<NodeHashFunctions>( 287 return m_impl.template insert<NodeHashFunctions>(
288 std::forward<IncomingValueType>(newValue), it.getNode()); 288 std::forward<IncomingValueType>(newValue), it.getNode());
289 } 289 }
290 290
291 void erase(ValuePeekInType); 291 void erase(ValuePeekInType);
292 void erase(iterator); 292 void erase(iterator);
293 void clear() { m_impl.clear(); } 293 void clear() { m_impl.clear(); }
294 template <typename Collection> 294 template <typename Collection>
295 void removeAll(const Collection& other) { 295 void removeAll(const Collection& other) {
296 WTF::removeAll(*this, other); 296 WTF::removeAll(*this, other);
297 } 297 }
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 } 807 }
808 808
809 template <typename Value, 809 template <typename Value,
810 typename HashFunctions, 810 typename HashFunctions,
811 typename Traits, 811 typename Traits,
812 typename Allocator> 812 typename Allocator>
813 template <typename IncomingValueType> 813 template <typename IncomingValueType>
814 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult 814 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult
815 LinkedHashSet<Value, HashFunctions, Traits, Allocator>::insert( 815 LinkedHashSet<Value, HashFunctions, Traits, Allocator>::insert(
816 IncomingValueType&& value) { 816 IncomingValueType&& value) {
817 return m_impl.template add<NodeHashFunctions>( 817 return m_impl.template insert<NodeHashFunctions>(
818 std::forward<IncomingValueType>(value), &m_anchor); 818 std::forward<IncomingValueType>(value), &m_anchor);
819 } 819 }
820 820
821 template <typename T, typename U, typename V, typename W> 821 template <typename T, typename U, typename V, typename W>
822 template <typename IncomingValueType> 822 template <typename IncomingValueType>
823 typename LinkedHashSet<T, U, V, W>::iterator 823 typename LinkedHashSet<T, U, V, W>::iterator
824 LinkedHashSet<T, U, V, W>::addReturnIterator(IncomingValueType&& value) { 824 LinkedHashSet<T, U, V, W>::addReturnIterator(IncomingValueType&& value) {
825 typename ImplType::AddResult result = m_impl.template add<NodeHashFunctions>( 825 typename ImplType::AddResult result =
826 std::forward<IncomingValueType>(value), &m_anchor); 826 m_impl.template insert<NodeHashFunctions>(
827 std::forward<IncomingValueType>(value), &m_anchor);
827 return makeIterator(result.storedValue); 828 return makeIterator(result.storedValue);
828 } 829 }
829 830
830 template <typename T, typename U, typename V, typename W> 831 template <typename T, typename U, typename V, typename W>
831 template <typename IncomingValueType> 832 template <typename IncomingValueType>
832 typename LinkedHashSet<T, U, V, W>::AddResult 833 typename LinkedHashSet<T, U, V, W>::AddResult
833 LinkedHashSet<T, U, V, W>::appendOrMoveToLast(IncomingValueType&& value) { 834 LinkedHashSet<T, U, V, W>::appendOrMoveToLast(IncomingValueType&& value) {
834 typename ImplType::AddResult result = m_impl.template add<NodeHashFunctions>( 835 typename ImplType::AddResult result =
835 std::forward<IncomingValueType>(value), &m_anchor); 836 m_impl.template insert<NodeHashFunctions>(
837 std::forward<IncomingValueType>(value), &m_anchor);
836 Node* node = result.storedValue; 838 Node* node = result.storedValue;
837 if (!result.isNewEntry) { 839 if (!result.isNewEntry) {
838 node->unlink(); 840 node->unlink();
839 m_anchor.insertBefore(*node); 841 m_anchor.insertBefore(*node);
840 } 842 }
841 return result; 843 return result;
842 } 844 }
843 845
844 template <typename T, typename U, typename V, typename W> 846 template <typename T, typename U, typename V, typename W>
845 template <typename IncomingValueType> 847 template <typename IncomingValueType>
846 typename LinkedHashSet<T, U, V, W>::AddResult 848 typename LinkedHashSet<T, U, V, W>::AddResult
847 LinkedHashSet<T, U, V, W>::prependOrMoveToFirst(IncomingValueType&& value) { 849 LinkedHashSet<T, U, V, W>::prependOrMoveToFirst(IncomingValueType&& value) {
848 typename ImplType::AddResult result = m_impl.template add<NodeHashFunctions>( 850 typename ImplType::AddResult result =
849 std::forward<IncomingValueType>(value), m_anchor.m_next); 851 m_impl.template insert<NodeHashFunctions>(
852 std::forward<IncomingValueType>(value), m_anchor.m_next);
850 Node* node = result.storedValue; 853 Node* node = result.storedValue;
851 if (!result.isNewEntry) { 854 if (!result.isNewEntry) {
852 node->unlink(); 855 node->unlink();
853 m_anchor.insertAfter(*node); 856 m_anchor.insertAfter(*node);
854 } 857 }
855 return result; 858 return result;
856 } 859 }
857 860
858 template <typename T, typename U, typename V, typename W> 861 template <typename T, typename U, typename V, typename W>
859 template <typename IncomingValueType> 862 template <typename IncomingValueType>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 swap(static_cast<Base&>(a), static_cast<Base&>(b)); 932 swap(static_cast<Base&>(a), static_cast<Base&>(b));
930 swap(a.m_value, b.m_value); 933 swap(a.m_value, b.m_value);
931 Allocator::leaveGCForbiddenScope(); 934 Allocator::leaveGCForbiddenScope();
932 } 935 }
933 936
934 } // namespace WTF 937 } // namespace WTF
935 938
936 using WTF::LinkedHashSet; 939 using WTF::LinkedHashSet;
937 940
938 #endif /* WTF_LinkedHashSet_h */ 941 #endif /* WTF_LinkedHashSet_h */
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/HashTable.h ('k') | third_party/WebKit/Source/platform/wtf/ListHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698