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

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

Issue 2725063003: Migrate WTF::LinkedHashSet/ListHashSet/HashTable::remove() to ::erase() (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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 add<NodeHashFunctions>(
288 std::forward<IncomingValueType>(newValue), it.getNode()); 288 std::forward<IncomingValueType>(newValue), it.getNode());
289 } 289 }
290 290
291 void remove(ValuePeekInType); 291 void erase(ValuePeekInType);
292 void remove(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 }
298 298
299 template <typename VisitorDispatcher> 299 template <typename VisitorDispatcher>
300 void trace(VisitorDispatcher visitor) { 300 void trace(VisitorDispatcher visitor) {
301 m_impl.trace(visitor); 301 m_impl.trace(visitor);
302 // Should the underlying table be moved by GC, register a callback 302 // Should the underlying table be moved by GC, register a callback
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 template <typename T, typename U, typename V, typename W> 858 template <typename T, typename U, typename V, typename W>
859 template <typename IncomingValueType> 859 template <typename IncomingValueType>
860 typename LinkedHashSet<T, U, V, W>::AddResult 860 typename LinkedHashSet<T, U, V, W>::AddResult
861 LinkedHashSet<T, U, V, W>::insertBefore(ValuePeekInType beforeValue, 861 LinkedHashSet<T, U, V, W>::insertBefore(ValuePeekInType beforeValue,
862 IncomingValueType&& newValue) { 862 IncomingValueType&& newValue) {
863 return insertBefore(find(beforeValue), 863 return insertBefore(find(beforeValue),
864 std::forward<IncomingValueType>(newValue)); 864 std::forward<IncomingValueType>(newValue));
865 } 865 }
866 866
867 template <typename T, typename U, typename V, typename W> 867 template <typename T, typename U, typename V, typename W>
868 inline void LinkedHashSet<T, U, V, W>::remove(iterator it) { 868 inline void LinkedHashSet<T, U, V, W>::erase(iterator it) {
869 if (it == end()) 869 if (it == end())
870 return; 870 return;
871 m_impl.remove(it.getNode()); 871 m_impl.remove(it.getNode());
872 } 872 }
873 873
874 template <typename T, typename U, typename V, typename W> 874 template <typename T, typename U, typename V, typename W>
875 inline void LinkedHashSet<T, U, V, W>::remove(ValuePeekInType value) { 875 inline void LinkedHashSet<T, U, V, W>::erase(ValuePeekInType value) {
876 remove(find(value)); 876 erase(find(value));
877 } 877 }
878 878
879 inline void swapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) { 879 inline void swapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
880 DCHECK(a.m_prev); 880 DCHECK(a.m_prev);
881 DCHECK(a.m_next); 881 DCHECK(a.m_next);
882 DCHECK(b.m_prev); 882 DCHECK(b.m_prev);
883 DCHECK(b.m_next); 883 DCHECK(b.m_next);
884 swap(a.m_prev, b.m_prev); 884 swap(a.m_prev, b.m_prev);
885 swap(a.m_next, b.m_next); 885 swap(a.m_next, b.m_next);
886 if (b.m_next == &a) { 886 if (b.m_next == &a) {
(...skipping 42 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/platform/loader/fetch/ResourceFetcher.cpp ('k') | third_party/WebKit/Source/wtf/ListHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698