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

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

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Created 4 years 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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #ifndef WTF_LinkedHashSet_h 23 #ifndef WTF_LinkedHashSet_h
24 #define WTF_LinkedHashSet_h 24 #define WTF_LinkedHashSet_h
25 25
26 #include "base/allocator/partition_allocator/partition_allocator.h"
26 #include "wtf/AddressSanitizer.h" 27 #include "wtf/AddressSanitizer.h"
27 #include "wtf/HashSet.h" 28 #include "wtf/HashSet.h"
28 #include "wtf/allocator/PartitionAllocator.h"
29 29
30 namespace WTF { 30 namespace WTF {
31 31
32 // LinkedHashSet: Just like HashSet, this class provides a Set 32 // LinkedHashSet: Just like HashSet, this class provides a Set
33 // interface - a collection of unique objects with O(1) insertion, 33 // interface - a collection of unique objects with O(1) insertion,
34 // removal and test for containership. However, it also has an 34 // removal and test for containership. However, it also has an
35 // order - iterating it will always give back values in the order 35 // order - iterating it will always give back values in the order
36 // in which they are added. 36 // in which they are added.
37 37
38 // Unlike ListHashSet, but like most WTF collections, iteration is NOT safe 38 // Unlike ListHashSet, but like most WTF collections, iteration is NOT safe
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 private: 151 private:
152 WTF_MAKE_NONCOPYABLE(LinkedHashSetNode); 152 WTF_MAKE_NONCOPYABLE(LinkedHashSetNode);
153 }; 153 };
154 154
155 template <typename ValueArg, 155 template <typename ValueArg,
156 typename HashFunctions = typename DefaultHash<ValueArg>::Hash, 156 typename HashFunctions = typename DefaultHash<ValueArg>::Hash,
157 typename TraitsArg = HashTraits<ValueArg>, 157 typename TraitsArg = HashTraits<ValueArg>,
158 typename Allocator = PartitionAllocator> 158 typename Allocator = PartitionAllocator>
159 class LinkedHashSet { 159 class LinkedHashSet {
160 WTF_USE_ALLOCATOR(LinkedHashSet, Allocator); 160 USE_ALLOCATOR(LinkedHashSet, Allocator);
161 161
162 private: 162 private:
163 typedef ValueArg Value; 163 typedef ValueArg Value;
164 typedef TraitsArg Traits; 164 typedef TraitsArg Traits;
165 typedef LinkedHashSetNode<Value, Allocator> Node; 165 typedef LinkedHashSetNode<Value, Allocator> Node;
166 typedef LinkedHashSetNodeBase NodeBase; 166 typedef LinkedHashSetNodeBase NodeBase;
167 typedef LinkedHashSetTranslator<Value, HashFunctions, Allocator> 167 typedef LinkedHashSetTranslator<Value, HashFunctions, Allocator>
168 NodeHashFunctions; 168 NodeHashFunctions;
169 typedef LinkedHashSetTraits<Value, Traits, Allocator> NodeHashTraits; 169 typedef LinkedHashSetTraits<Value, Traits, Allocator> NodeHashTraits;
170 170
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 swap(static_cast<Base&>(a), static_cast<Base&>(b)); 868 swap(static_cast<Base&>(a), static_cast<Base&>(b));
869 swap(a.m_value, b.m_value); 869 swap(a.m_value, b.m_value);
870 Allocator::leaveGCForbiddenScope(); 870 Allocator::leaveGCForbiddenScope();
871 } 871 }
872 872
873 } // namespace WTF 873 } // namespace WTF
874 874
875 using WTF::LinkedHashSet; 875 using WTF::LinkedHashSet;
876 876
877 #endif /* WTF_LinkedHashSet_h */ 877 #endif /* WTF_LinkedHashSet_h */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698