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

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

Issue 2688893002: Migrate WTF::HashSet::add() to ::insert() [continued] (Closed)
Patch Set: rebase, fix one platform-specific reference Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/wtf/HashSet.h ('k') | third_party/WebKit/Source/wtf/ListHashSet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 iterator find(const T&); 254 iterator find(const T&);
255 template <typename HashTranslator, typename T> 255 template <typename HashTranslator, typename T>
256 const_iterator find(const T&) const; 256 const_iterator find(const T&) const;
257 template <typename HashTranslator, typename T> 257 template <typename HashTranslator, typename T>
258 bool contains(const T&) const; 258 bool contains(const T&) const;
259 259
260 // The return value of add is a pair of a pointer to the stored value, 260 // The return value of add is a pair of a pointer to the stored value,
261 // and a bool that is true if an new entry was added. 261 // and a bool that is true if an new entry was added.
262 template <typename IncomingValueType> 262 template <typename IncomingValueType>
263 AddResult add(IncomingValueType&&); 263 AddResult add(IncomingValueType&&);
264 template <typename IncomingValueType>
265 AddResult insert(IncomingValueType&&);
264 266
265 // Same as add() except that the return value is an 267 // Same as add() except that the return value is an
266 // iterator. Useful in cases where it's needed to have the 268 // iterator. Useful in cases where it's needed to have the
267 // same return value as find() and where it's not possible to 269 // same return value as find() and where it's not possible to
268 // use a pointer to the storedValue. 270 // use a pointer to the storedValue.
269 template <typename IncomingValueType> 271 template <typename IncomingValueType>
270 iterator addReturnIterator(IncomingValueType&&); 272 iterator addReturnIterator(IncomingValueType&&);
271 273
272 // Add the value to the end of the collection. If the value was already in 274 // Add the value to the end of the collection. If the value was already in
273 // the list, it is moved to the end. 275 // the list, it is moved to the end.
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 typename Traits, 813 typename Traits,
812 typename Allocator> 814 typename Allocator>
813 template <typename IncomingValueType> 815 template <typename IncomingValueType>
814 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult 816 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult
815 LinkedHashSet<Value, HashFunctions, Traits, Allocator>::add( 817 LinkedHashSet<Value, HashFunctions, Traits, Allocator>::add(
816 IncomingValueType&& value) { 818 IncomingValueType&& value) {
817 return m_impl.template add<NodeHashFunctions>( 819 return m_impl.template add<NodeHashFunctions>(
818 std::forward<IncomingValueType>(value), &m_anchor); 820 std::forward<IncomingValueType>(value), &m_anchor);
819 } 821 }
820 822
823 template <typename Value,
824 typename HashFunctions,
825 typename Traits,
826 typename Allocator>
827 template <typename IncomingValueType>
828 typename LinkedHashSet<Value, HashFunctions, Traits, Allocator>::AddResult
829 LinkedHashSet<Value, HashFunctions, Traits, Allocator>::insert(
830 IncomingValueType&& value) {
831 return add(value);
832 }
833
821 template <typename T, typename U, typename V, typename W> 834 template <typename T, typename U, typename V, typename W>
822 template <typename IncomingValueType> 835 template <typename IncomingValueType>
823 typename LinkedHashSet<T, U, V, W>::iterator 836 typename LinkedHashSet<T, U, V, W>::iterator
824 LinkedHashSet<T, U, V, W>::addReturnIterator(IncomingValueType&& value) { 837 LinkedHashSet<T, U, V, W>::addReturnIterator(IncomingValueType&& value) {
825 typename ImplType::AddResult result = m_impl.template add<NodeHashFunctions>( 838 typename ImplType::AddResult result = m_impl.template add<NodeHashFunctions>(
826 std::forward<IncomingValueType>(value), &m_anchor); 839 std::forward<IncomingValueType>(value), &m_anchor);
827 return makeIterator(result.storedValue); 840 return makeIterator(result.storedValue);
828 } 841 }
829 842
830 template <typename T, typename U, typename V, typename W> 843 template <typename T, typename U, typename V, typename W>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 swap(static_cast<Base&>(a), static_cast<Base&>(b)); 942 swap(static_cast<Base&>(a), static_cast<Base&>(b));
930 swap(a.m_value, b.m_value); 943 swap(a.m_value, b.m_value);
931 Allocator::leaveGCForbiddenScope(); 944 Allocator::leaveGCForbiddenScope();
932 } 945 }
933 946
934 } // namespace WTF 947 } // namespace WTF
935 948
936 using WTF::LinkedHashSet; 949 using WTF::LinkedHashSet;
937 950
938 #endif /* WTF_LinkedHashSet_h */ 951 #endif /* WTF_LinkedHashSet_h */
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashSet.h ('k') | third_party/WebKit/Source/wtf/ListHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698