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 FallbackListCompositeKey_h | 5 #ifndef FallbackListCompositeKey_h |
6 #define FallbackListCompositeKey_h | 6 #define FallbackListCompositeKey_h |
7 | 7 |
8 #include "platform/fonts/FontCacheKey.h" | 8 #include "platform/fonts/FontCacheKey.h" |
9 #include "platform/fonts/FontDescription.h" | 9 #include "platform/fonts/FontDescription.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 m_auxiliaryBitmapFields(0) {} | 40 m_auxiliaryBitmapFields(0) {} |
41 FallbackListCompositeKey(WTF::HashTableDeletedValueType) | 41 FallbackListCompositeKey(WTF::HashTableDeletedValueType) |
42 : m_hash(s_deletedValueHash), | 42 : m_hash(s_deletedValueHash), |
43 m_computedSize(0), | 43 m_computedSize(0), |
44 m_letterSpacing(0), | 44 m_letterSpacing(0), |
45 m_wordSpacing(0), | 45 m_wordSpacing(0), |
46 m_bitmapFields(0), | 46 m_bitmapFields(0), |
47 m_auxiliaryBitmapFields(0) {} | 47 m_auxiliaryBitmapFields(0) {} |
48 | 48 |
49 void add(FontCacheKey key) { | 49 void add(FontCacheKey key) { |
50 m_fontCacheKeys.append(key); | 50 m_fontCacheKeys.push_back(key); |
51 // Djb2 with the first bit reserved for deleted. | 51 // Djb2 with the first bit reserved for deleted. |
52 m_hash = (((m_hash << 5) + m_hash) + key.hash()) << 1; | 52 m_hash = (((m_hash << 5) + m_hash) + key.hash()) << 1; |
53 } | 53 } |
54 | 54 |
55 unsigned hash() const { return m_hash; } | 55 unsigned hash() const { return m_hash; } |
56 | 56 |
57 bool operator==(const FallbackListCompositeKey& other) const { | 57 bool operator==(const FallbackListCompositeKey& other) const { |
58 return m_hash == other.m_hash && m_computedSize == other.m_computedSize && | 58 return m_hash == other.m_hash && m_computedSize == other.m_computedSize && |
59 m_letterSpacing == other.m_letterSpacing && | 59 m_letterSpacing == other.m_letterSpacing && |
60 m_wordSpacing == other.m_wordSpacing && | 60 m_wordSpacing == other.m_wordSpacing && |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 }; | 93 }; |
94 | 94 |
95 struct FallbackListCompositeKeyTraits | 95 struct FallbackListCompositeKeyTraits |
96 : WTF::SimpleClassHashTraits<FallbackListCompositeKey> { | 96 : WTF::SimpleClassHashTraits<FallbackListCompositeKey> { |
97 STATIC_ONLY(FallbackListCompositeKeyTraits); | 97 STATIC_ONLY(FallbackListCompositeKeyTraits); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace blink | 100 } // namespace blink |
101 | 101 |
102 #endif // FallbackListCompositeKey_h | 102 #endif // FallbackListCompositeKey_h |
OLD | NEW |