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 |
158 template <typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPt
r<P>> { | 175 template <typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPt
r<P>> { |
159 typedef std::nullptr_t EmptyValueType; | 176 typedef std::nullptr_t EmptyValueType; |
160 static EmptyValueType emptyValue() { return nullptr; } | 177 static EmptyValueType emptyValue() { return nullptr; } |
161 | 178 |
162 static const bool hasIsEmptyValueFunction = true; | 179 static const bool hasIsEmptyValueFunction = true; |
163 static bool isEmptyValue(const RefPtr<P>& value) { return !value; } | 180 static bool isEmptyValue(const RefPtr<P>& value) { return !value; } |
164 | 181 |
165 typedef RefPtrValuePeeker<P> PeekInType; | 182 typedef RefPtrValuePeeker<P> PeekInType; |
166 typedef RefPtr<P>* IteratorGetType; | 183 typedef RefPtr<P>* IteratorGetType; |
167 typedef const RefPtr<P>* IteratorConstGetType; | 184 typedef const RefPtr<P>* IteratorConstGetType; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 struct TraceInCollectionTrait; | 349 struct TraceInCollectionTrait; |
333 | 350 |
334 } // namespace WTF | 351 } // namespace WTF |
335 | 352 |
336 using WTF::HashTraits; | 353 using WTF::HashTraits; |
337 using WTF::PairHashTraits; | 354 using WTF::PairHashTraits; |
338 using WTF::NullableHashTraits; | 355 using WTF::NullableHashTraits; |
339 using WTF::SimpleClassHashTraits; | 356 using WTF::SimpleClassHashTraits; |
340 | 357 |
341 #endif // WTF_HashTraits_h | 358 #endif // WTF_HashTraits_h |
OLD | NEW |