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 13 matching lines...) Expand all Loading... |
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/css/CSSInheritedValue.h" | 31 #include "core/css/CSSInheritedValue.h" |
32 #include "core/css/CSSInitialValue.h" | 32 #include "core/css/CSSInitialValue.h" |
33 #include "core/css/CSSPrimitiveValue.h" | 33 #include "core/css/CSSPrimitiveValue.h" |
34 #include "core/css/CSSUnsetValue.h" | |
35 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
36 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
37 #include "wtf/text/AtomicStringHash.h" | 36 #include "wtf/text/AtomicStringHash.h" |
38 | 37 |
39 namespace blink { | 38 namespace blink { |
40 | 39 |
41 class CSSValueList; | 40 class CSSValueList; |
42 | 41 |
43 class CSSValuePool : public NoBaseWillBeGarbageCollected<CSSValuePool> { | 42 class CSSValuePool : public NoBaseWillBeGarbageCollected<CSSValuePool> { |
44 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 43 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
45 public: | 44 public: |
46 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); | 45 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); |
47 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createFontFamilyValue(const String
&); | 46 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createFontFamilyValue(const String
&); |
48 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } | 47 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } |
49 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } | 48 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } |
50 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } | 49 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } |
51 PassRefPtrWillBeRawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetVal
ue; } | |
52 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); | 50 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); |
53 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyI
D identifier); | 51 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSPropertyI
D identifier); |
54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue
); | 52 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue
); |
55 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); | 53 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); |
56 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const String& value, C
SSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type)
; } | 54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const String& value, C
SSPrimitiveValue::UnitType type) { return CSSPrimitiveValue::create(value, type)
; } |
57 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst RenderStyle&); | 55 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst RenderStyle&); |
58 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } | 56 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); } | 57 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } |
60 | 58 |
61 void trace(Visitor*); | 59 void trace(Visitor*); |
62 | 60 |
63 private: | 61 private: |
64 CSSValuePool(); | 62 CSSValuePool(); |
65 | 63 |
66 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; | 64 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; |
67 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; | 65 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; |
68 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; | 66 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; |
69 RefPtrWillBeMember<CSSUnsetValue> m_unsetValue; | |
70 | 67 |
71 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; | 68 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; |
72 | 69 |
73 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPrimitiveValue> >
ColorValueCache; | 70 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSPrimitiveValue> >
ColorValueCache; |
74 ColorValueCache m_colorValueCache; | 71 ColorValueCache m_colorValueCache; |
75 RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent; | 72 RefPtrWillBeMember<CSSPrimitiveValue> m_colorTransparent; |
76 RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite; | 73 RefPtrWillBeMember<CSSPrimitiveValue> m_colorWhite; |
77 RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack; | 74 RefPtrWillBeMember<CSSPrimitiveValue> m_colorBlack; |
78 | 75 |
79 static const int maximumCacheableIntegerValue = 255; | 76 static const int maximumCacheableIntegerValue = 255; |
80 | 77 |
81 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; | 78 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; |
82 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; | 79 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; |
83 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; | 80 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; |
84 | 81 |
85 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<CSSValueList> > F
ontFaceValueCache; | 82 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<CSSValueList> > F
ontFaceValueCache; |
86 FontFaceValueCache m_fontFaceValueCache; | 83 FontFaceValueCache m_fontFaceValueCache; |
87 | 84 |
88 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<CSSPrimitiveValue> > Fo
ntFamilyValueCache; | 85 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<CSSPrimitiveValue> > Fo
ntFamilyValueCache; |
89 FontFamilyValueCache m_fontFamilyValueCache; | 86 FontFamilyValueCache m_fontFamilyValueCache; |
90 | 87 |
91 friend CSSValuePool& cssValuePool(); | 88 friend CSSValuePool& cssValuePool(); |
92 }; | 89 }; |
93 | 90 |
94 CSSValuePool& cssValuePool(); | 91 CSSValuePool& cssValuePool(); |
95 | 92 |
96 } | 93 } |
97 | 94 |
98 #endif | 95 #endif |
OLD | NEW |