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

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

Issue 2725343002: Migrate WTF::LinkedHashSet/ListHashSet::last() to ::back() (Closed)
Patch Set: rebase Created 3 years, 9 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 reverse_iterator rend() { return makeReverseIterator(0); } 160 reverse_iterator rend() { return makeReverseIterator(0); }
161 const_reverse_iterator rbegin() const { 161 const_reverse_iterator rbegin() const {
162 return makeConstReverseIterator(m_tail); 162 return makeConstReverseIterator(m_tail);
163 } 163 }
164 const_reverse_iterator rend() const { return makeConstReverseIterator(0); } 164 const_reverse_iterator rend() const { return makeConstReverseIterator(0); }
165 165
166 ValueType& front(); 166 ValueType& front();
167 const ValueType& front() const; 167 const ValueType& front() const;
168 void removeFirst(); 168 void removeFirst();
169 169
170 ValueType& last(); 170 ValueType& back();
171 const ValueType& last() const; 171 const ValueType& back() const;
172 void removeLast(); 172 void removeLast();
173 173
174 iterator find(ValuePeekInType); 174 iterator find(ValuePeekInType);
175 const_iterator find(ValuePeekInType) const; 175 const_iterator find(ValuePeekInType) const;
176 bool contains(ValuePeekInType) const; 176 bool contains(ValuePeekInType) const;
177 177
178 // An alternate version of find() that finds the object by hashing and 178 // An alternate version of find() that finds the object by hashing and
179 // comparing with some other type, to avoid the cost of type conversion. 179 // comparing with some other type, to avoid the cost of type conversion.
180 // The HashTranslator interface is defined in HashSet. 180 // The HashTranslator interface is defined in HashSet.
181 template <typename HashTranslator, typename T> 181 template <typename HashTranslator, typename T>
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 unlinkAndDelete(m_head); 821 unlinkAndDelete(m_head);
822 } 822 }
823 823
824 template <typename T, size_t inlineCapacity, typename U, typename V> 824 template <typename T, size_t inlineCapacity, typename U, typename V>
825 inline const T& ListHashSet<T, inlineCapacity, U, V>::front() const { 825 inline const T& ListHashSet<T, inlineCapacity, U, V>::front() const {
826 DCHECK(!isEmpty()); 826 DCHECK(!isEmpty());
827 return m_head->m_value; 827 return m_head->m_value;
828 } 828 }
829 829
830 template <typename T, size_t inlineCapacity, typename U, typename V> 830 template <typename T, size_t inlineCapacity, typename U, typename V>
831 inline T& ListHashSet<T, inlineCapacity, U, V>::last() { 831 inline T& ListHashSet<T, inlineCapacity, U, V>::back() {
832 DCHECK(!isEmpty()); 832 DCHECK(!isEmpty());
833 return m_tail->m_value; 833 return m_tail->m_value;
834 } 834 }
835 835
836 template <typename T, size_t inlineCapacity, typename U, typename V> 836 template <typename T, size_t inlineCapacity, typename U, typename V>
837 inline const T& ListHashSet<T, inlineCapacity, U, V>::last() const { 837 inline const T& ListHashSet<T, inlineCapacity, U, V>::back() const {
838 DCHECK(!isEmpty()); 838 DCHECK(!isEmpty());
839 return m_tail->m_value; 839 return m_tail->m_value;
840 } 840 }
841 841
842 template <typename T, size_t inlineCapacity, typename U, typename V> 842 template <typename T, size_t inlineCapacity, typename U, typename V>
843 inline void ListHashSet<T, inlineCapacity, U, V>::removeLast() { 843 inline void ListHashSet<T, inlineCapacity, U, V>::removeLast() {
844 DCHECK(!isEmpty()); 844 DCHECK(!isEmpty());
845 m_impl.remove(m_tail); 845 m_impl.remove(m_tail);
846 unlinkAndDelete(m_tail); 846 unlinkAndDelete(m_tail);
847 } 847 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/LinkedHashSet.h ('k') | third_party/WebKit/Source/wtf/ListHashSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698