OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CustomElementDescriptorHash_h |
| 6 #define CustomElementDescriptorHash_h |
| 7 |
| 8 #include "core/dom/custom/CustomElementDescriptor.h" |
| 9 #include "wtf/HashFunctions.h" |
| 10 #include "wtf/HashTraits.h" |
| 11 #include "wtf/text/AtomicStringHash.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 struct CustomElementDescriptorHash { |
| 16 STATIC_ONLY(CustomElementDescriptorHash); |
| 17 static unsigned hash(const CustomElementDescriptor& descriptor) |
| 18 { |
| 19 return WTF::hashInts( |
| 20 AtomicStringHash::hash(descriptor.name()), |
| 21 AtomicStringHash::hash(descriptor.localName())); |
| 22 } |
| 23 |
| 24 static bool equal( |
| 25 const CustomElementDescriptor& a, |
| 26 const CustomElementDescriptor& b) |
| 27 { |
| 28 return a == b; |
| 29 } |
| 30 |
| 31 static const bool safeToCompareToEmptyOrDeleted = true; |
| 32 }; |
| 33 |
| 34 } // namespace blink |
| 35 |
| 36 namespace WTF { |
| 37 |
| 38 template<> |
| 39 struct HashTraits<blink::CustomElementDescriptor> |
| 40 : SimpleClassHashTraits<blink::CustomElementDescriptor> { |
| 41 STATIC_ONLY(HashTraits); |
| 42 static const bool emptyValueIsZero = |
| 43 HashTraits<AtomicString>::emptyValueIsZero; |
| 44 }; |
| 45 |
| 46 template<> |
| 47 struct DefaultHash<blink::CustomElementDescriptor> { |
| 48 using Hash = blink::CustomElementDescriptorHash; |
| 49 }; |
| 50 |
| 51 } // namespace WTF |
| 52 |
| 53 #endif // CustomElementDescriptorHash_h |
OLD | NEW |