OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 using FontFaceValueCache = | 56 using FontFaceValueCache = |
57 HeapHashMap<AtomicString, Member<const CSSValueList>>; | 57 HeapHashMap<AtomicString, Member<const CSSValueList>>; |
58 static const unsigned maximumFontFaceCacheSize = 128; | 58 static const unsigned maximumFontFaceCacheSize = 128; |
59 using FontFamilyValueCache = HeapHashMap<String, Member<CSSFontFamilyValue>>; | 59 using FontFamilyValueCache = HeapHashMap<String, Member<CSSFontFamilyValue>>; |
60 | 60 |
61 // Cached individual values. | 61 // Cached individual values. |
62 CSSColorValue* transparentColor() { return m_colorTransparent; } | 62 CSSColorValue* transparentColor() { return m_colorTransparent; } |
63 CSSColorValue* whiteColor() { return m_colorWhite; } | 63 CSSColorValue* whiteColor() { return m_colorWhite; } |
64 CSSColorValue* blackColor() { return m_colorBlack; } | 64 CSSColorValue* blackColor() { return m_colorBlack; } |
65 CSSInheritedValue* inheritedValue() { return m_inheritedValue; } | 65 CSSInheritedValue* inheritedValue() { return m_inheritedValue; } |
66 CSSInitialValue* implicitInitialValue() { return m_implicitInitialValue; } | 66 CSSInitialValue* initialValue() { return m_initialValue; } |
67 CSSInitialValue* explicitInitialValue() { return m_explicitInitialValue; } | |
68 CSSUnsetValue* unsetValue() { return m_unsetValue; } | 67 CSSUnsetValue* unsetValue() { return m_unsetValue; } |
69 | 68 |
70 // Vector caches. | 69 // Vector caches. |
71 CSSIdentifierValue* identifierCacheValue(CSSValueID ident) { | 70 CSSIdentifierValue* identifierCacheValue(CSSValueID ident) { |
72 return m_identifierValueCache[ident]; | 71 return m_identifierValueCache[ident]; |
73 } | 72 } |
74 CSSIdentifierValue* setIdentifierCacheValue(CSSValueID ident, | 73 CSSIdentifierValue* setIdentifierCacheValue(CSSValueID ident, |
75 CSSIdentifierValue* cssValue) { | 74 CSSIdentifierValue* cssValue) { |
76 return m_identifierValueCache[ident] = cssValue; | 75 return m_identifierValueCache[ident] = cssValue; |
77 } | 76 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return m_fontFaceValueCache.add(string, nullptr); | 115 return m_fontFaceValueCache.add(string, nullptr); |
117 } | 116 } |
118 | 117 |
119 DECLARE_TRACE(); | 118 DECLARE_TRACE(); |
120 | 119 |
121 private: | 120 private: |
122 CSSValuePool(); | 121 CSSValuePool(); |
123 | 122 |
124 // Cached individual values. | 123 // Cached individual values. |
125 Member<CSSInheritedValue> m_inheritedValue; | 124 Member<CSSInheritedValue> m_inheritedValue; |
126 Member<CSSInitialValue> m_implicitInitialValue; | 125 Member<CSSInitialValue> m_initialValue; |
127 Member<CSSInitialValue> m_explicitInitialValue; | |
128 Member<CSSUnsetValue> m_unsetValue; | 126 Member<CSSUnsetValue> m_unsetValue; |
129 Member<CSSColorValue> m_colorTransparent; | 127 Member<CSSColorValue> m_colorTransparent; |
130 Member<CSSColorValue> m_colorWhite; | 128 Member<CSSColorValue> m_colorWhite; |
131 Member<CSSColorValue> m_colorBlack; | 129 Member<CSSColorValue> m_colorBlack; |
132 | 130 |
133 // Vector caches. | 131 // Vector caches. |
134 HeapVector<Member<CSSIdentifierValue>, numCSSValueKeywords> | 132 HeapVector<Member<CSSIdentifierValue>, numCSSValueKeywords> |
135 m_identifierValueCache; | 133 m_identifierValueCache; |
136 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> | 134 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> |
137 m_pixelValueCache; | 135 m_pixelValueCache; |
138 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> | 136 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> |
139 m_percentValueCache; | 137 m_percentValueCache; |
140 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> | 138 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> |
141 m_numberValueCache; | 139 m_numberValueCache; |
142 | 140 |
143 // Hash map caches. | 141 // Hash map caches. |
144 ColorValueCache m_colorValueCache; | 142 ColorValueCache m_colorValueCache; |
145 FontFaceValueCache m_fontFaceValueCache; | 143 FontFaceValueCache m_fontFaceValueCache; |
146 FontFamilyValueCache m_fontFamilyValueCache; | 144 FontFamilyValueCache m_fontFamilyValueCache; |
147 | 145 |
148 friend CORE_EXPORT CSSValuePool& cssValuePool(); | 146 friend CORE_EXPORT CSSValuePool& cssValuePool(); |
149 }; | 147 }; |
150 | 148 |
151 CORE_EXPORT CSSValuePool& cssValuePool(); | 149 CORE_EXPORT CSSValuePool& cssValuePool(); |
152 | 150 |
153 } // namespace blink | 151 } // namespace blink |
154 | 152 |
155 #endif | 153 #endif |
OLD | NEW |