| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_WTF_HASH_UTIL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_WTF_HASH_UTIL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_WTF_HASH_UTIL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_WTF_HASH_UTIL_H_ |
| 7 | 7 |
| 8 #include <type_traits> | 8 #include <type_traits> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/bindings/lib/hash_util.h" | 10 #include "mojo/public/cpp/bindings/lib/hash_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 template <typename T> | 55 template <typename T> |
| 56 size_t WTFHash(size_t seed, const T& value) { | 56 size_t WTFHash(size_t seed, const T& value) { |
| 57 return WTFHashTraits<T>::Hash(seed, value); | 57 return WTFHashTraits<T>::Hash(seed, value); |
| 58 } | 58 } |
| 59 | 59 |
| 60 template <typename T> | 60 template <typename T> |
| 61 struct StructPtrHashFn { | 61 struct StructPtrHashFn { |
| 62 static unsigned hash(const StructPtr<T>& value) { | 62 static unsigned GetHash(const StructPtr<T>& value) { |
| 63 return value.Hash(kHashSeed); | 63 return value.Hash(kHashSeed); |
| 64 } | 64 } |
| 65 static bool equal(const StructPtr<T>& left, const StructPtr<T>& right) { | 65 static bool Equal(const StructPtr<T>& left, const StructPtr<T>& right) { |
| 66 return left.Equals(right); | 66 return left.Equals(right); |
| 67 } | 67 } |
| 68 static const bool safeToCompareToEmptyOrDeleted = false; | 68 static const bool safeToCompareToEmptyOrDeleted = false; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 template <typename T> | 71 template <typename T> |
| 72 struct InlinedStructPtrHashFn { | 72 struct InlinedStructPtrHashFn { |
| 73 static unsigned hash(const InlinedStructPtr<T>& value) { | 73 static unsigned GetHash(const InlinedStructPtr<T>& value) { |
| 74 return value.Hash(kHashSeed); | 74 return value.Hash(kHashSeed); |
| 75 } | 75 } |
| 76 static bool equal(const InlinedStructPtr<T>& left, | 76 static bool Equal(const InlinedStructPtr<T>& left, |
| 77 const InlinedStructPtr<T>& right) { | 77 const InlinedStructPtr<T>& right) { |
| 78 return left.Equals(right); | 78 return left.Equals(right); |
| 79 } | 79 } |
| 80 static const bool safeToCompareToEmptyOrDeleted = false; | 80 static const bool safeToCompareToEmptyOrDeleted = false; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace internal | 83 } // namespace internal |
| 84 } // namespace mojo | 84 } // namespace mojo |
| 85 | 85 |
| 86 namespace WTF { | 86 namespace WTF { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 static bool isDeletedValue(const mojo::InlinedStructPtr<T>& value) { | 124 static bool isDeletedValue(const mojo::InlinedStructPtr<T>& value) { |
| 125 return mojo::internal::InlinedStructPtrWTFHelper< | 125 return mojo::internal::InlinedStructPtrWTFHelper< |
| 126 T>::IsHashTableDeletedValue(value); | 126 T>::IsHashTableDeletedValue(value); |
| 127 } | 127 } |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 } // namespace WTF | 130 } // namespace WTF |
| 131 | 131 |
| 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_WTF_HASH_UTIL_H_ | 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_WTF_HASH_UTIL_H_ |
| OLD | NEW |