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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 typedef PassRefPtr<P> PassOutType; | 204 typedef PassRefPtr<P> PassOutType; |
205 static PassOutType passOut(RefPtr<P>& value) { return value.release(); } | 205 static PassOutType passOut(RefPtr<P>& value) { return value.release(); } |
206 static PassOutType passOut(std::nullptr_t) { return nullptr; } | 206 static PassOutType passOut(std::nullptr_t) { return nullptr; } |
207 | 207 |
208 typedef P* PeekOutType; | 208 typedef P* PeekOutType; |
209 static PeekOutType peek(const RefPtr<P>& value) { return value.get(); } | 209 static PeekOutType peek(const RefPtr<P>& value) { return value.get(); } |
210 static PeekOutType peek(std::nullptr_t) { return 0; } | 210 static PeekOutType peek(std::nullptr_t) { return 0; } |
211 }; | 211 }; |
212 | 212 |
213 template <typename T> struct HashTraits<RawPtr<T>> : HashTraits<T*> { }; | |
214 | |
215 template <typename T> | 213 template <typename T> |
216 struct HashTraits<std::unique_ptr<T>> : SimpleClassHashTraits<std::unique_ptr<T>
> { | 214 struct HashTraits<std::unique_ptr<T>> : SimpleClassHashTraits<std::unique_ptr<T>
> { |
217 using EmptyValueType = std::nullptr_t; | 215 using EmptyValueType = std::nullptr_t; |
218 static EmptyValueType emptyValue() { return nullptr; } | 216 static EmptyValueType emptyValue() { return nullptr; } |
219 | 217 |
220 static const bool hasIsEmptyValueFunction = true; | 218 static const bool hasIsEmptyValueFunction = true; |
221 static bool isEmptyValue(const std::unique_ptr<T>& value) { return !value; } | 219 static bool isEmptyValue(const std::unique_ptr<T>& value) { return !value; } |
222 | 220 |
223 using PeekInType = T*; | 221 using PeekInType = T*; |
224 | 222 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 struct TraceInCollectionTrait; | 367 struct TraceInCollectionTrait; |
370 | 368 |
371 } // namespace WTF | 369 } // namespace WTF |
372 | 370 |
373 using WTF::HashTraits; | 371 using WTF::HashTraits; |
374 using WTF::PairHashTraits; | 372 using WTF::PairHashTraits; |
375 using WTF::NullableHashTraits; | 373 using WTF::NullableHashTraits; |
376 using WTF::SimpleClassHashTraits; | 374 using WTF::SimpleClassHashTraits; |
377 | 375 |
378 #endif // WTF_HashTraits_h | 376 #endif // WTF_HashTraits_h |
OLD | NEW |