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 25 matching lines...) Expand all Loading... |
36 #include "core/css/CSSValueList.h" | 36 #include "core/css/CSSValueList.h" |
37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
39 #include "wtf/text/AtomicStringHash.h" | 39 #include "wtf/text/AtomicStringHash.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class CORE_EXPORT CSSValuePool : public NoBaseWillBeGarbageCollectedFinalized<C
SSValuePool> { | 43 class CORE_EXPORT CSSValuePool : public NoBaseWillBeGarbageCollectedFinalized<C
SSValuePool> { |
44 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSValuePool); | 44 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(CSSValuePool); |
45 public: | 45 public: |
46 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); | 46 PassRefPtr<CSSValueList> createFontFaceValue(const AtomicString&); |
47 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createFontFamilyValue(const String
&); | 47 PassRefPtr<CSSPrimitiveValue> createFontFamilyValue(const String&); |
48 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } | 48 PassRefPtr<CSSInheritedValue> createInheritedValue() { return m_inheritedVal
ue; } |
49 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } | 49 PassRefPtr<CSSInitialValue> createImplicitInitialValue() { return m_implicit
InitialValue; } |
50 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } | 50 PassRefPtr<CSSInitialValue> createExplicitInitialValue() { return m_explicit
InitialValue; } |
51 PassRefPtrWillBeRawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetVal
ue; } | 51 PassRefPtr<CSSUnsetValue> createUnsetValue() { return m_unsetValue; } |
52 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); | 52 PassRefPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier); |
53 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyI
D identifier); | 53 PassRefPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier
); |
54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue
); | 54 PassRefPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue); |
55 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); | 55 PassRefPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::U
nitType); |
56 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const String& value, C
SSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type)
; } | 56 PassRefPtr<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveV
alue::UnitType type) { return CSSPrimitiveValue::create(value, type); } |
57 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst ComputedStyle&); | 57 PassRefPtr<CSSPrimitiveValue> createValue(const Length& value, const Compute
dStyle&); |
58 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } | 58 PassRefPtr<CSSPrimitiveValue> createValue(const Length& value, float zoom) {
return CSSPrimitiveValue::create(value, zoom); } |
59 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } | 59 template<typename T> static PassRefPtr<CSSPrimitiveValue> createValue(T valu
e) { return CSSPrimitiveValue::create(value); } |
60 | 60 |
61 DECLARE_TRACE(); | 61 DECLARE_TRACE(); |
62 | 62 |
63 private: | 63 private: |
64 CSSValuePool(); | 64 CSSValuePool(); |
65 | 65 |
66 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; | 66 RefPtr<CSSInheritedValue> m_inheritedValue; |
67 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; | 67 RefPtr<CSSInitialValue> m_implicitInitialValue; |
68 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; | 68 RefPtr<CSSInitialValue> m_explicitInitialValue; |
69 RefPtrWillBeMember<CSSUnsetValue> m_unsetValue; | 69 RefPtr<CSSUnsetValue> m_unsetValue; |
70 | 70 |
71 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; | 71 Vector<RefPtr<CSSPrimitiveValue>, numCSSValueKeywords> m_identifierValueCach
e; |
72 | 72 |
73 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPrimitiveValue>> C
olorValueCache; | 73 typedef HashMap<unsigned, RefPtr<CSSPrimitiveValue>> ColorValueCache; |
74 ColorValueCache m_colorValueCache; | 74 ColorValueCache m_colorValueCache; |
75 RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent; | 75 RefPtr<CSSPrimitiveValue> m_colorTransparent; |
76 RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite; | 76 RefPtr<CSSPrimitiveValue> m_colorWhite; |
77 RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack; | 77 RefPtr<CSSPrimitiveValue> m_colorBlack; |
78 | 78 |
79 static const int maximumCacheableIntegerValue = 255; | 79 static const int maximumCacheableIntegerValue = 255; |
80 | 80 |
81 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; | 81 Vector<RefPtr<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pixelV
alueCache; |
82 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; | 82 Vector<RefPtr<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_percen
tValueCache; |
83 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; | 83 Vector<RefPtr<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_number
ValueCache; |
84 | 84 |
85 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<CSSValueList>> Fo
ntFaceValueCache; | 85 typedef WillBeHeapHashMap<AtomicString, RefPtr<CSSValueList>> FontFaceValueC
ache; |
86 FontFaceValueCache m_fontFaceValueCache; | 86 FontFaceValueCache m_fontFaceValueCache; |
87 | 87 |
88 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<CSSPrimitiveValue>> Fon
tFamilyValueCache; | 88 typedef WillBeHeapHashMap<String, RefPtr<CSSPrimitiveValue>> FontFamilyValue
Cache; |
89 FontFamilyValueCache m_fontFamilyValueCache; | 89 FontFamilyValueCache m_fontFamilyValueCache; |
90 | 90 |
91 friend CORE_EXPORT CSSValuePool& cssValuePool(); | 91 friend CORE_EXPORT CSSValuePool& cssValuePool(); |
92 }; | 92 }; |
93 | 93 |
94 CORE_EXPORT CSSValuePool& cssValuePool(); | 94 CORE_EXPORT CSSValuePool& cssValuePool(); |
95 | 95 |
96 } | 96 } |
97 | 97 |
98 #endif | 98 #endif |
OLD | NEW |