Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorHash.h

Issue 1996213002: Add a tuple of name, local name for hashing custom element definitions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Give CustomElementDefinition a CustomElementDescriptor. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698