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

Side by Side Diff: third_party/WebKit/Source/wtf/LinkedHashSet.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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return makeConstReverseIterator(lastNode()); 232 return makeConstReverseIterator(lastNode());
233 } 233 }
234 const_reverse_iterator rend() const { 234 const_reverse_iterator rend() const {
235 return makeConstReverseIterator(anchor()); 235 return makeConstReverseIterator(anchor());
236 } 236 }
237 237
238 Value& front(); 238 Value& front();
239 const Value& front() const; 239 const Value& front() const;
240 void removeFirst(); 240 void removeFirst();
241 241
242 Value& last(); 242 Value& back();
243 const Value& last() const; 243 const Value& back() const;
244 void removeLast(); 244 void removeLast();
245 245
246 iterator find(ValuePeekInType); 246 iterator find(ValuePeekInType);
247 const_iterator find(ValuePeekInType) const; 247 const_iterator find(ValuePeekInType) const;
248 bool contains(ValuePeekInType) const; 248 bool contains(ValuePeekInType) const;
249 249
250 // An alternate version of find() that finds the object by hashing and 250 // An alternate version of find() that finds the object by hashing and
251 // comparing with some other type, to avoid the cost of type conversion. 251 // comparing with some other type, to avoid the cost of type conversion.
252 // The HashTranslator interface is defined in HashSet. 252 // The HashTranslator interface is defined in HashSet.
253 template <typename HashTranslator, typename T> 253 template <typename HashTranslator, typename T>
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 return firstNode()->m_value; 711 return firstNode()->m_value;
712 } 712 }
713 713
714 template <typename T, typename U, typename V, typename W> 714 template <typename T, typename U, typename V, typename W>
715 inline void LinkedHashSet<T, U, V, W>::removeFirst() { 715 inline void LinkedHashSet<T, U, V, W>::removeFirst() {
716 DCHECK(!isEmpty()); 716 DCHECK(!isEmpty());
717 m_impl.remove(static_cast<Node*>(m_anchor.m_next)); 717 m_impl.remove(static_cast<Node*>(m_anchor.m_next));
718 } 718 }
719 719
720 template <typename T, typename U, typename V, typename W> 720 template <typename T, typename U, typename V, typename W>
721 inline T& LinkedHashSet<T, U, V, W>::last() { 721 inline T& LinkedHashSet<T, U, V, W>::back() {
722 DCHECK(!isEmpty()); 722 DCHECK(!isEmpty());
723 return lastNode()->m_value; 723 return lastNode()->m_value;
724 } 724 }
725 725
726 template <typename T, typename U, typename V, typename W> 726 template <typename T, typename U, typename V, typename W>
727 inline const T& LinkedHashSet<T, U, V, W>::last() const { 727 inline const T& LinkedHashSet<T, U, V, W>::back() const {
728 DCHECK(!isEmpty()); 728 DCHECK(!isEmpty());
729 return lastNode()->m_value; 729 return lastNode()->m_value;
730 } 730 }
731 731
732 template <typename T, typename U, typename V, typename W> 732 template <typename T, typename U, typename V, typename W>
733 inline void LinkedHashSet<T, U, V, W>::removeLast() { 733 inline void LinkedHashSet<T, U, V, W>::removeLast() {
734 DCHECK(!isEmpty()); 734 DCHECK(!isEmpty());
735 m_impl.remove(static_cast<Node*>(m_anchor.m_prev)); 735 m_impl.remove(static_cast<Node*>(m_anchor.m_prev));
736 } 736 }
737 737
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 swap(static_cast<Base&>(a), static_cast<Base&>(b)); 929 swap(static_cast<Base&>(a), static_cast<Base&>(b));
930 swap(a.m_value, b.m_value); 930 swap(a.m_value, b.m_value);
931 Allocator::leaveGCForbiddenScope(); 931 Allocator::leaveGCForbiddenScope();
932 } 932 }
933 933
934 } // namespace WTF 934 } // namespace WTF
935 935
936 using WTF::LinkedHashSet; 936 using WTF::LinkedHashSet;
937 937
938 #endif /* WTF_LinkedHashSet_h */ 938 #endif /* WTF_LinkedHashSet_h */
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp ('k') | third_party/WebKit/Source/wtf/ListHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698