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

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

Issue 256743005: Add removeAll method to sets and maps and use them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moved implementation of removeAll to HashTable.h and shared it. Also added it to LinkedHashSet Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/LinkedHashSet.h ('k') | Source/wtf/text/TextEncodingRegistry.cpp » ('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 reserv ed. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> 3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Add the value to the beginning of the collection. If the value was al ready in 149 // Add the value to the beginning of the collection. If the value was al ready in
150 // the list, it is moved to the beginning. 150 // the list, it is moved to the beginning.
151 AddResult prependOrMoveToFirst(ValuePeekInType); 151 AddResult prependOrMoveToFirst(ValuePeekInType);
152 152
153 AddResult insertBefore(ValuePeekInType beforeValue, ValuePeekInType newV alue); 153 AddResult insertBefore(ValuePeekInType beforeValue, ValuePeekInType newV alue);
154 AddResult insertBefore(iterator, ValuePeekInType); 154 AddResult insertBefore(iterator, ValuePeekInType);
155 155
156 void remove(ValuePeekInType); 156 void remove(ValuePeekInType);
157 void remove(iterator); 157 void remove(iterator);
158 void clear(); 158 void clear();
159 template<typename Collection>
160 void removeAll(const Collection& other) { WTF::removeAll(*this, other); }
159 161
160 private: 162 private:
161 void unlink(Node*); 163 void unlink(Node*);
162 void unlinkAndDelete(Node*); 164 void unlinkAndDelete(Node*);
163 void appendNode(Node*); 165 void appendNode(Node*);
164 void prependNode(Node*); 166 void prependNode(Node*);
165 void insertNodeBefore(Node* beforeNode, Node* newNode); 167 void insertNodeBefore(Node* beforeNode, Node* newNode);
166 void deleteAllNodes(); 168 void deleteAllNodes();
167 void createAllocatorIfNeeded(); 169 void createAllocatorIfNeeded();
168 170
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collect ion) 970 inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collect ion)
969 { 971 {
970 deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueT ype>(collection.m_impl); 972 deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueT ype>(collection.m_impl);
971 } 973 }
972 974
973 } // namespace WTF 975 } // namespace WTF
974 976
975 using WTF::ListHashSet; 977 using WTF::ListHashSet;
976 978
977 #endif /* WTF_ListHashSet_h */ 979 #endif /* WTF_ListHashSet_h */
OLDNEW
« no previous file with comments | « Source/wtf/LinkedHashSet.h ('k') | Source/wtf/text/TextEncodingRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698