Chromium Code Reviews| 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 | |
|
Yuki
2016/05/20 05:57:00
nit: no need an empty line?
| |
| 42 STATIC_ONLY(HashTraits); | |
| 43 static const bool emptyValueIsZero = | |
| 44 HashTraits<AtomicString>::emptyValueIsZero; | |
| 45 }; | |
| 46 | |
| 47 template<> | |
| 48 struct DefaultHash<blink::CustomElementDescriptor> { | |
| 49 typedef blink::CustomElementDescriptorHash Hash; | |
|
yosin_UTC9
2016/05/20 09:01:16
nit: Let's be C++11'ish ;-)
using Hash = blink::C
| |
| 50 }; | |
| 51 | |
| 52 } // namespace WTF | |
| 53 | |
| 54 #endif // CustomElementDescriptorHash_h | |
| OLD | NEW |