OLD | NEW |
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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #ifndef WTF_LinkedHashSet_h | 22 #ifndef WTF_LinkedHashSet_h |
23 #define WTF_LinkedHashSet_h | 23 #define WTF_LinkedHashSet_h |
24 | 24 |
25 #include "wtf/AddressSanitizer.h" | 25 #include "wtf/AddressSanitizer.h" |
26 #include "wtf/DefaultAllocator.h" | |
27 #include "wtf/HashSet.h" | 26 #include "wtf/HashSet.h" |
28 #include "wtf/OwnPtr.h" | 27 #include "wtf/OwnPtr.h" |
| 28 #include "wtf/PartitionAllocator.h" |
29 #include "wtf/PassOwnPtr.h" | 29 #include "wtf/PassOwnPtr.h" |
30 | 30 |
31 namespace WTF { | 31 namespace WTF { |
32 | 32 |
33 // LinkedHashSet: Just like HashSet, this class provides a Set | 33 // LinkedHashSet: Just like HashSet, this class provides a Set |
34 // interface - a collection of unique objects with O(1) insertion, | 34 // interface - a collection of unique objects with O(1) insertion, |
35 // removal and test for containership. However, it also has an | 35 // removal and test for containership. However, it also has an |
36 // order - iterating it will always give back values in the order | 36 // order - iterating it will always give back values in the order |
37 // in which they are added. | 37 // in which they are added. |
38 | 38 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 private: | 132 private: |
133 // Not used. | 133 // Not used. |
134 LinkedHashSetNode(const LinkedHashSetNode&); | 134 LinkedHashSetNode(const LinkedHashSetNode&); |
135 }; | 135 }; |
136 | 136 |
137 template< | 137 template< |
138 typename ValueArg, | 138 typename ValueArg, |
139 typename HashFunctions = typename DefaultHash<ValueArg>::Hash, | 139 typename HashFunctions = typename DefaultHash<ValueArg>::Hash, |
140 typename TraitsArg = HashTraits<ValueArg>, | 140 typename TraitsArg = HashTraits<ValueArg>, |
141 typename Allocator = DefaultAllocator> | 141 typename Allocator = PartitionAllocator> |
142 class LinkedHashSet { | 142 class LinkedHashSet { |
143 WTF_USE_ALLOCATOR(LinkedHashSet, Allocator); | 143 WTF_USE_ALLOCATOR(LinkedHashSet, Allocator); |
144 private: | 144 private: |
145 typedef ValueArg Value; | 145 typedef ValueArg Value; |
146 typedef TraitsArg Traits; | 146 typedef TraitsArg Traits; |
147 typedef LinkedHashSetNode<Value, Allocator> Node; | 147 typedef LinkedHashSetNode<Value, Allocator> Node; |
148 typedef LinkedHashSetNodeBase NodeBase; | 148 typedef LinkedHashSetNodeBase NodeBase; |
149 typedef LinkedHashSetTranslator<Value, HashFunctions, Allocator> NodeHashFun
ctions; | 149 typedef LinkedHashSetTranslator<Value, HashFunctions, Allocator> NodeHashFun
ctions; |
150 typedef LinkedHashSetTraits<Value, Traits, Allocator> NodeHashTraits; | 150 typedef LinkedHashSetTraits<Value, Traits, Allocator> NodeHashTraits; |
151 | 151 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 struct NeedsTracing<LinkedHashSet<T, U, V>> { | 725 struct NeedsTracing<LinkedHashSet<T, U, V>> { |
726 static const bool value = false; | 726 static const bool value = false; |
727 }; | 727 }; |
728 #endif | 728 #endif |
729 | 729 |
730 } | 730 } |
731 | 731 |
732 using WTF::LinkedHashSet; | 732 using WTF::LinkedHashSet; |
733 | 733 |
734 #endif /* WTF_LinkedHashSet_h */ | 734 #endif /* WTF_LinkedHashSet_h */ |
OLD | NEW |