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 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 template <typename T> struct SimpleClassHashTraits : GenericHashTraits<T> { | 148 template <typename T> struct SimpleClassHashTraits : GenericHashTraits<T> { |
149 static const bool emptyValueIsZero = true; | 149 static const bool emptyValueIsZero = true; |
150 template <typename U = void> | 150 template <typename U = void> |
151 struct NeedsToForbidGCOnMove { | 151 struct NeedsToForbidGCOnMove { |
152 static const bool value = false; | 152 static const bool value = false; |
153 }; | 153 }; |
154 static void constructDeletedValue(T& slot, bool) { new (NotNull, &slot) T(Ha
shTableDeletedValue); } | 154 static void constructDeletedValue(T& slot, bool) { new (NotNull, &slot) T(Ha
shTableDeletedValue); } |
155 static bool isDeletedValue(const T& value) { return value.isHashTableDeleted
Value(); } | 155 static bool isDeletedValue(const T& value) { return value.isHashTableDeleted
Value(); } |
156 }; | 156 }; |
157 | 157 |
158 template <typename P> struct HashTraits<OwnPtr<P>> : SimpleClassHashTraits<OwnPt
r<P>> { | |
159 typedef std::nullptr_t EmptyValueType; | |
160 | |
161 static EmptyValueType emptyValue() { return nullptr; } | |
162 | |
163 static const bool hasIsEmptyValueFunction = true; | |
164 static bool isEmptyValue(const OwnPtr<P>& value) { return !value; } | |
165 | |
166 typedef typename OwnPtr<P>::PtrType PeekInType; | |
167 | |
168 static void store(PassOwnPtr<P> value, OwnPtr<P>& storage) { storage = std::
move(value); } | |
169 | |
170 typedef typename OwnPtr<P>::PtrType PeekOutType; | |
171 static PeekOutType peek(const OwnPtr<P>& value) { return value.get(); } | |
172 static PeekOutType peek(std::nullptr_t) { return 0; } | |
173 }; | |
174 | |
175 template <typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPt
r<P>> { | 158 template <typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPt
r<P>> { |
176 typedef std::nullptr_t EmptyValueType; | 159 typedef std::nullptr_t EmptyValueType; |
177 static EmptyValueType emptyValue() { return nullptr; } | 160 static EmptyValueType emptyValue() { return nullptr; } |
178 | 161 |
179 static const bool hasIsEmptyValueFunction = true; | 162 static const bool hasIsEmptyValueFunction = true; |
180 static bool isEmptyValue(const RefPtr<P>& value) { return !value; } | 163 static bool isEmptyValue(const RefPtr<P>& value) { return !value; } |
181 | 164 |
182 typedef RefPtrValuePeeker<P> PeekInType; | 165 typedef RefPtrValuePeeker<P> PeekInType; |
183 typedef RefPtr<P>* IteratorGetType; | 166 typedef RefPtr<P>* IteratorGetType; |
184 typedef const RefPtr<P>* IteratorConstGetType; | 167 typedef const RefPtr<P>* IteratorConstGetType; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 struct TraceInCollectionTrait; | 332 struct TraceInCollectionTrait; |
350 | 333 |
351 } // namespace WTF | 334 } // namespace WTF |
352 | 335 |
353 using WTF::HashTraits; | 336 using WTF::HashTraits; |
354 using WTF::PairHashTraits; | 337 using WTF::PairHashTraits; |
355 using WTF::NullableHashTraits; | 338 using WTF::NullableHashTraits; |
356 using WTF::SimpleClassHashTraits; | 339 using WTF::SimpleClassHashTraits; |
357 | 340 |
358 #endif // WTF_HashTraits_h | 341 #endif // WTF_HashTraits_h |
OLD | NEW |