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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 static const unsigned maximumColorCacheSize = 512; | 52 static const unsigned maximumColorCacheSize = 512; |
53 using FontFaceValueCache = HeapHashMap<AtomicString, Member<const CSSValueLi
st>>; | 53 using FontFaceValueCache = HeapHashMap<AtomicString, Member<const CSSValueLi
st>>; |
54 static const unsigned maximumFontFaceCacheSize = 128; | 54 static const unsigned maximumFontFaceCacheSize = 128; |
55 using FontFamilyValueCache = HeapHashMap<String, Member<CSSFontFamilyValue>>
; | 55 using FontFamilyValueCache = HeapHashMap<String, Member<CSSFontFamilyValue>>
; |
56 | 56 |
57 // Cached individual values. | 57 // Cached individual values. |
58 CSSColorValue* transparentColor() { return m_colorTransparent; } | 58 CSSColorValue* transparentColor() { return m_colorTransparent; } |
59 CSSColorValue* whiteColor() { return m_colorWhite; } | 59 CSSColorValue* whiteColor() { return m_colorWhite; } |
60 CSSColorValue* blackColor() { return m_colorBlack; } | 60 CSSColorValue* blackColor() { return m_colorBlack; } |
61 CSSInheritedValue* inheritedValue() { return m_inheritedValue; } | 61 CSSInheritedValue* inheritedValue() { return m_inheritedValue; } |
62 CSSInitialValue* implicitInitialValue() { return m_implicitInitialValue; } | 62 CSSInitialValue* initialValue() { return m_initialValue; } |
63 CSSInitialValue* explicitInitialValue() { return m_explicitInitialValue; } | |
64 CSSUnsetValue* unsetValue() { return m_unsetValue; } | 63 CSSUnsetValue* unsetValue() { return m_unsetValue; } |
65 | 64 |
66 // CSSPrimitiveValue vector caches. | 65 // CSSPrimitiveValue vector caches. |
67 CSSPrimitiveValue* identifierCacheValue(CSSValueID ident) { return m_identif
ierValueCache[ident]; } | 66 CSSPrimitiveValue* identifierCacheValue(CSSValueID ident) { return m_identif
ierValueCache[ident]; } |
68 CSSPrimitiveValue* setIdentifierCacheValue(CSSValueID ident, CSSPrimitiveVal
ue* cssValue) { return m_identifierValueCache[ident] = cssValue; } | 67 CSSPrimitiveValue* setIdentifierCacheValue(CSSValueID ident, CSSPrimitiveVal
ue* cssValue) { return m_identifierValueCache[ident] = cssValue; } |
69 CSSPrimitiveValue* pixelCacheValue(int intValue) { return m_pixelValueCache[
intValue]; } | 68 CSSPrimitiveValue* pixelCacheValue(int intValue) { return m_pixelValueCache[
intValue]; } |
70 CSSPrimitiveValue* setPixelCacheValue(int intValue, CSSPrimitiveValue* cssVa
lue) { return m_pixelValueCache[intValue] = cssValue; } | 69 CSSPrimitiveValue* setPixelCacheValue(int intValue, CSSPrimitiveValue* cssVa
lue) { return m_pixelValueCache[intValue] = cssValue; } |
71 CSSPrimitiveValue* percentCacheValue(int intValue) { return m_percentValueCa
che[intValue]; } | 70 CSSPrimitiveValue* percentCacheValue(int intValue) { return m_percentValueCa
che[intValue]; } |
72 CSSPrimitiveValue* setPercentCacheValue(int intValue, CSSPrimitiveValue* css
Value) { return m_percentValueCache[intValue] = cssValue; } | 71 CSSPrimitiveValue* setPercentCacheValue(int intValue, CSSPrimitiveValue* css
Value) { return m_percentValueCache[intValue] = cssValue; } |
73 CSSPrimitiveValue* numberCacheValue(int intValue) { return m_numberValueCach
e[intValue]; } | 72 CSSPrimitiveValue* numberCacheValue(int intValue) { return m_numberValueCach
e[intValue]; } |
(...skipping 19 matching lines...) Expand all Loading... |
93 return m_fontFaceValueCache.add(string, nullptr); | 92 return m_fontFaceValueCache.add(string, nullptr); |
94 } | 93 } |
95 | 94 |
96 DECLARE_TRACE(); | 95 DECLARE_TRACE(); |
97 | 96 |
98 private: | 97 private: |
99 CSSValuePool(); | 98 CSSValuePool(); |
100 | 99 |
101 // Cached individual values. | 100 // Cached individual values. |
102 Member<CSSInheritedValue> m_inheritedValue; | 101 Member<CSSInheritedValue> m_inheritedValue; |
103 Member<CSSInitialValue> m_implicitInitialValue; | 102 Member<CSSInitialValue> m_initialValue; |
104 Member<CSSInitialValue> m_explicitInitialValue; | |
105 Member<CSSUnsetValue> m_unsetValue; | 103 Member<CSSUnsetValue> m_unsetValue; |
106 Member<CSSColorValue> m_colorTransparent; | 104 Member<CSSColorValue> m_colorTransparent; |
107 Member<CSSColorValue> m_colorWhite; | 105 Member<CSSColorValue> m_colorWhite; |
108 Member<CSSColorValue> m_colorBlack; | 106 Member<CSSColorValue> m_colorBlack; |
109 | 107 |
110 // CSSPrimitiveValue vector caches. | 108 // CSSPrimitiveValue vector caches. |
111 HeapVector<Member<CSSPrimitiveValue>, numCSSValueKeywords> m_identifierValue
Cache; | 109 HeapVector<Member<CSSPrimitiveValue>, numCSSValueKeywords> m_identifierValue
Cache; |
112 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pi
xelValueCache; | 110 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pi
xelValueCache; |
113 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pe
rcentValueCache; | 111 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pe
rcentValueCache; |
114 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_nu
mberValueCache; | 112 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_nu
mberValueCache; |
115 | 113 |
116 // Hash map caches. | 114 // Hash map caches. |
117 ColorValueCache m_colorValueCache; | 115 ColorValueCache m_colorValueCache; |
118 FontFaceValueCache m_fontFaceValueCache; | 116 FontFaceValueCache m_fontFaceValueCache; |
119 FontFamilyValueCache m_fontFamilyValueCache; | 117 FontFamilyValueCache m_fontFamilyValueCache; |
120 | 118 |
121 friend CORE_EXPORT CSSValuePool& cssValuePool(); | 119 friend CORE_EXPORT CSSValuePool& cssValuePool(); |
122 }; | 120 }; |
123 | 121 |
124 CORE_EXPORT CSSValuePool& cssValuePool(); | 122 CORE_EXPORT CSSValuePool& cssValuePool(); |
125 | 123 |
126 } // namespace blink | 124 } // namespace blink |
127 | 125 |
128 #endif | 126 #endif |
OLD | NEW |