| 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 11 matching lines...) Expand all Loading... |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef CSSValuePool_h | 26 #ifndef CSSValuePool_h |
| 27 #define CSSValuePool_h | 27 #define CSSValuePool_h |
| 28 | 28 |
| 29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
| 30 #include "core/CSSValueKeywords.h" | 30 #include "core/CSSValueKeywords.h" |
| 31 #include "core/CoreExport.h" | 31 #include "core/CoreExport.h" |
| 32 #include "core/css/CSSColorValue.h" |
| 32 #include "core/css/CSSCustomIdentValue.h" | 33 #include "core/css/CSSCustomIdentValue.h" |
| 33 #include "core/css/CSSInheritedValue.h" | 34 #include "core/css/CSSInheritedValue.h" |
| 34 #include "core/css/CSSInitialValue.h" | 35 #include "core/css/CSSInitialValue.h" |
| 35 #include "core/css/CSSPrimitiveValue.h" | 36 #include "core/css/CSSPrimitiveValue.h" |
| 36 #include "core/css/CSSUnsetValue.h" | 37 #include "core/css/CSSUnsetValue.h" |
| 37 #include "core/css/CSSValueList.h" | 38 #include "core/css/CSSValueList.h" |
| 38 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 40 #include "wtf/text/AtomicStringHash.h" | 41 #include "wtf/text/AtomicStringHash.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 class CORE_EXPORT CSSValuePool : public NoBaseWillBeGarbageCollectedFinalized<C
SSValuePool> { | 45 class CORE_EXPORT CSSValuePool : public NoBaseWillBeGarbageCollectedFinalized<C
SSValuePool> { |
| 45 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSValuePool); | 46 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSValuePool); |
| 46 public: | 47 public: |
| 47 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); | 48 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); |
| 48 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createFontFamilyValue(const Stri
ng&); | 49 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createFontFamilyValue(const Stri
ng&); |
| 49 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } | 50 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } |
| 50 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } | 51 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } |
| 51 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } | 52 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } |
| 52 PassRefPtrWillBeRawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetVal
ue; } | 53 PassRefPtrWillBeRawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetVal
ue; } |
| 53 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); | 54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); |
| 54 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createIdentifierValue(CSSPropert
yID identifier); | 55 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createIdentifierValue(CSSPropert
yID identifier); |
| 55 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue
); | 56 PassRefPtrWillBeRawPtr<CSSColorValue> createColorValue(RGBA32 rgbValue); |
| 56 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); | 57 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); |
| 57 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst ComputedStyle&); | 58 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst ComputedStyle&); |
| 58 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } | 59 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } |
| 59 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } | 60 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } |
| 60 | 61 |
| 61 DECLARE_TRACE(); | 62 DECLARE_TRACE(); |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 CSSValuePool(); | 65 CSSValuePool(); |
| 65 | 66 |
| 66 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; | 67 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; |
| 67 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; | 68 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; |
| 68 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; | 69 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; |
| 69 RefPtrWillBeMember<CSSUnsetValue> m_unsetValue; | 70 RefPtrWillBeMember<CSSUnsetValue> m_unsetValue; |
| 70 | 71 |
| 71 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; | 72 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; |
| 72 | 73 |
| 73 using ColorValueCache = WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPr
imitiveValue>>; | 74 using ColorValueCache = WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSCo
lorValue>>; |
| 74 ColorValueCache m_colorValueCache; | 75 ColorValueCache m_colorValueCache; |
| 75 RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent; | 76 RefPtrWillBeMember<CSSColorValue> m_colorTransparent; |
| 76 RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite; | 77 RefPtrWillBeMember<CSSColorValue> m_colorWhite; |
| 77 RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack; | 78 RefPtrWillBeMember<CSSColorValue> m_colorBlack; |
| 78 | 79 |
| 79 static const int maximumCacheableIntegerValue = 255; | 80 static const int maximumCacheableIntegerValue = 255; |
| 80 | 81 |
| 81 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; | 82 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; |
| 82 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; | 83 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; |
| 83 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; | 84 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; |
| 84 | 85 |
| 85 using FontFaceValueCache = WillBeHeapHashMap<AtomicString, RefPtrWillBeMembe
r<CSSValueList>>; | 86 using FontFaceValueCache = WillBeHeapHashMap<AtomicString, RefPtrWillBeMembe
r<CSSValueList>>; |
| 86 FontFaceValueCache m_fontFaceValueCache; | 87 FontFaceValueCache m_fontFaceValueCache; |
| 87 | 88 |
| 88 using FontFamilyValueCache = WillBeHeapHashMap<String, RefPtrWillBeMember<CS
SCustomIdentValue>>; | 89 using FontFamilyValueCache = WillBeHeapHashMap<String, RefPtrWillBeMember<CS
SCustomIdentValue>>; |
| 89 FontFamilyValueCache m_fontFamilyValueCache; | 90 FontFamilyValueCache m_fontFamilyValueCache; |
| 90 | 91 |
| 91 friend CORE_EXPORT CSSValuePool& cssValuePool(); | 92 friend CORE_EXPORT CSSValuePool& cssValuePool(); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 CORE_EXPORT CSSValuePool& cssValuePool(); | 95 CORE_EXPORT CSSValuePool& cssValuePool(); |
| 95 | 96 |
| 96 } | 97 } |
| 97 | 98 |
| 98 #endif | 99 #endif |
| OLD | NEW |