OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 public: | 51 public: |
52 FontCacheKey() : m_creationParams(), m_fontSize(0), m_options(0) {} | 52 FontCacheKey() : m_creationParams(), m_fontSize(0), m_options(0) {} |
53 FontCacheKey(FontFaceCreationParams creationParams, | 53 FontCacheKey(FontFaceCreationParams creationParams, |
54 float fontSize, | 54 float fontSize, |
55 unsigned options, | 55 unsigned options, |
56 PassRefPtr<FontVariationSettings> variationSettings) | 56 PassRefPtr<FontVariationSettings> variationSettings) |
57 : m_creationParams(creationParams), | 57 : m_creationParams(creationParams), |
58 m_fontSize(fontSize * s_fontSizePrecisionMultiplier), | 58 m_fontSize(fontSize * s_fontSizePrecisionMultiplier), |
59 m_options(options), | 59 m_options(options), |
60 m_variationSettings(variationSettings) {} | 60 m_variationSettings(std::move(variationSettings)) {} |
61 | 61 |
62 FontCacheKey(WTF::HashTableDeletedValueType) | 62 FontCacheKey(WTF::HashTableDeletedValueType) |
63 : m_fontSize(hashTableDeletedSize()) {} | 63 : m_fontSize(hashTableDeletedSize()) {} |
64 | 64 |
65 unsigned hash() const { | 65 unsigned hash() const { |
66 unsigned hashCodes[4] = { | 66 unsigned hashCodes[4] = { |
67 m_creationParams.hash(), m_fontSize, m_options, | 67 m_creationParams.hash(), m_fontSize, m_options, |
68 m_variationSettings ? m_variationSettings->hash() : 0}; | 68 m_variationSettings ? m_variationSettings->hash() : 0}; |
69 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); | 69 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); |
70 } | 70 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static const bool safeToCompareToEmptyOrDeleted = true; | 105 static const bool safeToCompareToEmptyOrDeleted = true; |
106 }; | 106 }; |
107 | 107 |
108 struct FontCacheKeyTraits : WTF::SimpleClassHashTraits<FontCacheKey> { | 108 struct FontCacheKeyTraits : WTF::SimpleClassHashTraits<FontCacheKey> { |
109 STATIC_ONLY(FontCacheKeyTraits); | 109 STATIC_ONLY(FontCacheKeyTraits); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace blink | 112 } // namespace blink |
113 | 113 |
114 #endif // FontCacheKey_h | 114 #endif // FontCacheKey_h |
OLD | NEW |