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

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

Issue 2722413005: Migrate WTF::LinkedHashSet/ListHashSet::first() to ::front() (Closed)
Patch Set: 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 const_iterator begin() const { return makeConstIterator(m_head); } 156 const_iterator begin() const { return makeConstIterator(m_head); }
157 const_iterator end() const { return makeConstIterator(0); } 157 const_iterator end() const { return makeConstIterator(0); }
158 158
159 reverse_iterator rbegin() { return makeReverseIterator(m_tail); } 159 reverse_iterator rbegin() { return makeReverseIterator(m_tail); }
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& first(); 166 ValueType& front();
167 const ValueType& first() const; 167 const ValueType& front() const;
168 void removeFirst(); 168 void removeFirst();
169 169
170 ValueType& last(); 170 ValueType& last();
171 const ValueType& last() const; 171 const ValueType& last() 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
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 802
803 template <typename T, size_t inlineCapacity, typename U, typename V> 803 template <typename T, size_t inlineCapacity, typename U, typename V>
804 inline void ListHashSet<T, inlineCapacity, U, V>::finalize() { 804 inline void ListHashSet<T, inlineCapacity, U, V>::finalize() {
805 static_assert(!Allocator::isGarbageCollected, 805 static_assert(!Allocator::isGarbageCollected,
806 "heap allocated ListHashSet should never call finalize()"); 806 "heap allocated ListHashSet should never call finalize()");
807 deleteAllNodes(); 807 deleteAllNodes();
808 m_allocatorProvider.releaseAllocator(); 808 m_allocatorProvider.releaseAllocator();
809 } 809 }
810 810
811 template <typename T, size_t inlineCapacity, typename U, typename V> 811 template <typename T, size_t inlineCapacity, typename U, typename V>
812 inline T& ListHashSet<T, inlineCapacity, U, V>::first() { 812 inline T& ListHashSet<T, inlineCapacity, U, V>::front() {
813 DCHECK(!isEmpty()); 813 DCHECK(!isEmpty());
814 return m_head->m_value; 814 return m_head->m_value;
815 } 815 }
816 816
817 template <typename T, size_t inlineCapacity, typename U, typename V> 817 template <typename T, size_t inlineCapacity, typename U, typename V>
818 inline void ListHashSet<T, inlineCapacity, U, V>::removeFirst() { 818 inline void ListHashSet<T, inlineCapacity, U, V>::removeFirst() {
819 DCHECK(!isEmpty()); 819 DCHECK(!isEmpty());
820 m_impl.remove(m_head); 820 m_impl.remove(m_head);
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>::first() 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>::last() {
832 DCHECK(!isEmpty()); 832 DCHECK(!isEmpty());
833 return m_tail->m_value; 833 return m_tail->m_value;
834 } 834 }
835 835
(...skipping 290 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