OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 PropertyHandle_h | 5 #ifndef PropertyHandle_h |
6 #define PropertyHandle_h | 6 #define PropertyHandle_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/dom/QualifiedName.h" | 10 #include "core/dom/QualifiedName.h" |
| 11 #include "wtf/Allocator.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class CORE_EXPORT PropertyHandle { | 15 class CORE_EXPORT PropertyHandle { |
| 16 ALLOW_ONLY_INLINE_ALLOCATION(); |
15 public: | 17 public: |
16 explicit PropertyHandle(CSSPropertyID property) | 18 explicit PropertyHandle(CSSPropertyID property) |
17 : handleType(HandleCSSProperty) | 19 : handleType(HandleCSSProperty) |
18 , property(property) | 20 , property(property) |
19 { | 21 { |
20 ASSERT(property != CSSPropertyInvalid); | 22 ASSERT(property != CSSPropertyInvalid); |
21 } | 23 } |
22 | 24 |
23 explicit PropertyHandle(const QualifiedName& attributeName) | 25 explicit PropertyHandle(const QualifiedName& attributeName) |
24 : handleType(HandleSVGAttribute) | 26 : handleType(HandleSVGAttribute) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 67 |
66 friend struct ::WTF::HashTraits<blink::PropertyHandle>; | 68 friend struct ::WTF::HashTraits<blink::PropertyHandle>; |
67 }; | 69 }; |
68 | 70 |
69 } // namespace blink | 71 } // namespace blink |
70 | 72 |
71 namespace WTF { | 73 namespace WTF { |
72 | 74 |
73 template<> struct DefaultHash<blink::PropertyHandle> { | 75 template<> struct DefaultHash<blink::PropertyHandle> { |
74 struct Hash { | 76 struct Hash { |
| 77 STATIC_ONLY(Hash); |
75 static unsigned hash(const blink::PropertyHandle& handle) { return handl
e.hash(); } | 78 static unsigned hash(const blink::PropertyHandle& handle) { return handl
e.hash(); } |
76 | 79 |
77 static bool equal(const blink::PropertyHandle& a, const blink::PropertyH
andle& b) { return a == b; } | 80 static bool equal(const blink::PropertyHandle& a, const blink::PropertyH
andle& b) { return a == b; } |
78 | 81 |
79 static const bool safeToCompareToEmptyOrDeleted = true; | 82 static const bool safeToCompareToEmptyOrDeleted = true; |
80 }; | 83 }; |
81 }; | 84 }; |
82 | 85 |
83 template<> struct HashTraits<blink::PropertyHandle> : SimpleClassHashTraits<blin
k::PropertyHandle> { | 86 template<> struct HashTraits<blink::PropertyHandle> : SimpleClassHashTraits<blin
k::PropertyHandle> { |
84 static const bool needsDestruction = false; | 87 static const bool needsDestruction = false; |
85 static void constructDeletedValue(blink::PropertyHandle& slot, bool) | 88 static void constructDeletedValue(blink::PropertyHandle& slot, bool) |
86 { | 89 { |
87 new (NotNull, &slot) blink::PropertyHandle(blink::PropertyHandle::delete
dValueForHashTraits()); | 90 new (NotNull, &slot) blink::PropertyHandle(blink::PropertyHandle::delete
dValueForHashTraits()); |
88 } | 91 } |
89 static bool isDeletedValue(blink::PropertyHandle value) | 92 static bool isDeletedValue(blink::PropertyHandle value) |
90 { | 93 { |
91 return value.isDeletedValueForHashTraits(); | 94 return value.isDeletedValueForHashTraits(); |
92 } | 95 } |
93 | 96 |
94 static blink::PropertyHandle emptyValue() | 97 static blink::PropertyHandle emptyValue() |
95 { | 98 { |
96 return blink::PropertyHandle::emptyValueForHashTraits(); | 99 return blink::PropertyHandle::emptyValueForHashTraits(); |
97 } | 100 } |
98 }; | 101 }; |
99 | 102 |
100 } // namespace WTF | 103 } // namespace WTF |
101 | 104 |
102 #endif // PropertyHandle_h | 105 #endif // PropertyHandle_h |
OLD | NEW |