| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/css/CSSInitialValue.h" | 35 #include "core/css/CSSInitialValue.h" |
| 36 #include "core/css/CSSPrimitiveValue.h" | 36 #include "core/css/CSSPrimitiveValue.h" |
| 37 #include "core/css/CSSUnsetValue.h" | 37 #include "core/css/CSSUnsetValue.h" |
| 38 #include "core/css/CSSValueList.h" | 38 #include "core/css/CSSValueList.h" |
| 39 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 #include "wtf/text/AtomicStringHash.h" | 41 #include "wtf/text/AtomicStringHash.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class CORE_EXPORT CSSValuePool : public NoBaseWillBeGarbageCollectedFinalized<C
SSValuePool> { | 45 class CORE_EXPORT CSSValuePool : public GarbageCollectedFinalized<CSSValuePool>
{ |
| 46 USING_FAST_MALLOC_WILL_BE_REMOVED(CSSValuePool); | |
| 47 public: | 46 public: |
| 48 PassRefPtrWillBeRawPtr<CSSValueList> createFontFaceValue(const AtomicString&
); | 47 RawPtr<CSSValueList> createFontFaceValue(const AtomicString&); |
| 49 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createFontFamilyValue(const Stri
ng&); | 48 RawPtr<CSSCustomIdentValue> createFontFamilyValue(const String&); |
| 50 PassRefPtrWillBeRawPtr<CSSInheritedValue> createInheritedValue() { return m_
inheritedValue; } | 49 RawPtr<CSSInheritedValue> createInheritedValue() { return m_inheritedValue;
} |
| 51 PassRefPtrWillBeRawPtr<CSSInitialValue> createImplicitInitialValue() { retur
n m_implicitInitialValue; } | 50 RawPtr<CSSInitialValue> createImplicitInitialValue() { return m_implicitInit
ialValue; } |
| 52 PassRefPtrWillBeRawPtr<CSSInitialValue> createExplicitInitialValue() { retur
n m_explicitInitialValue; } | 51 RawPtr<CSSInitialValue> createExplicitInitialValue() { return m_explicitInit
ialValue; } |
| 53 PassRefPtrWillBeRawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetVal
ue; } | 52 RawPtr<CSSUnsetValue> createUnsetValue() { return m_unsetValue; } |
| 54 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID i
dentifier); | 53 RawPtr<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier); |
| 55 PassRefPtrWillBeRawPtr<CSSCustomIdentValue> createIdentifierValue(CSSPropert
yID identifier); | 54 RawPtr<CSSCustomIdentValue> createIdentifierValue(CSSPropertyID identifier); |
| 56 PassRefPtrWillBeRawPtr<CSSColorValue> createColorValue(RGBA32 rgbValue); | 55 RawPtr<CSSColorValue> createColorValue(RGBA32 rgbValue); |
| 57 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimi
tiveValue::UnitType); | 56 RawPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitT
ype); |
| 58 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, c
onst ComputedStyle&); | 57 RawPtr<CSSPrimitiveValue> createValue(const Length& value, const ComputedSty
le&); |
| 59 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createValue(const Length& value, f
loat zoom) { return CSSPrimitiveValue::create(value, zoom); } | 58 RawPtr<CSSPrimitiveValue> createValue(const Length& value, float zoom) { ret
urn CSSPrimitiveValue::create(value, zoom); } |
| 60 template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create
Value(T value) { return CSSPrimitiveValue::create(value); } | 59 template<typename T> static RawPtr<CSSPrimitiveValue> createValue(T value) {
return CSSPrimitiveValue::create(value); } |
| 61 | 60 |
| 62 DECLARE_TRACE(); | 61 DECLARE_TRACE(); |
| 63 | 62 |
| 64 private: | 63 private: |
| 65 CSSValuePool(); | 64 CSSValuePool(); |
| 66 | 65 |
| 67 RefPtrWillBeMember<CSSInheritedValue> m_inheritedValue; | 66 Member<CSSInheritedValue> m_inheritedValue; |
| 68 RefPtrWillBeMember<CSSInitialValue> m_implicitInitialValue; | 67 Member<CSSInitialValue> m_implicitInitialValue; |
| 69 RefPtrWillBeMember<CSSInitialValue> m_explicitInitialValue; | 68 Member<CSSInitialValue> m_explicitInitialValue; |
| 70 RefPtrWillBeMember<CSSUnsetValue> m_unsetValue; | 69 Member<CSSUnsetValue> m_unsetValue; |
| 71 | 70 |
| 72 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, numCSSValueKeywords>
m_identifierValueCache; | 71 HeapVector<Member<CSSPrimitiveValue>, numCSSValueKeywords> m_identifierValue
Cache; |
| 73 | 72 |
| 74 using ColorValueCache = WillBeHeapHashMap<unsigned, RefPtrWillBeMember<CSSCo
lorValue>>; | 73 using ColorValueCache = HeapHashMap<unsigned, Member<CSSColorValue>>; |
| 75 ColorValueCache m_colorValueCache; | 74 ColorValueCache m_colorValueCache; |
| 76 RefPtrWillBeMember<CSSColorValue> m_colorTransparent; | 75 Member<CSSColorValue> m_colorTransparent; |
| 77 RefPtrWillBeMember<CSSColorValue> m_colorWhite; | 76 Member<CSSColorValue> m_colorWhite; |
| 78 RefPtrWillBeMember<CSSColorValue> m_colorBlack; | 77 Member<CSSColorValue> m_colorBlack; |
| 79 | 78 |
| 80 static const int maximumCacheableIntegerValue = 255; | 79 static const int maximumCacheableIntegerValue = 255; |
| 81 | 80 |
| 82 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_pixelValueCache; | 81 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pi
xelValueCache; |
| 83 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_percentValueCache; | 82 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_pe
rcentValueCache; |
| 84 WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>, maximumCacheableInte
gerValue + 1> m_numberValueCache; | 83 HeapVector<Member<CSSPrimitiveValue>, maximumCacheableIntegerValue + 1> m_nu
mberValueCache; |
| 85 | 84 |
| 86 using FontFaceValueCache = WillBeHeapHashMap<AtomicString, RefPtrWillBeMembe
r<CSSValueList>>; | 85 using FontFaceValueCache = HeapHashMap<AtomicString, Member<CSSValueList>>; |
| 87 FontFaceValueCache m_fontFaceValueCache; | 86 FontFaceValueCache m_fontFaceValueCache; |
| 88 | 87 |
| 89 using FontFamilyValueCache = WillBeHeapHashMap<String, RefPtrWillBeMember<CS
SCustomIdentValue>>; | 88 using FontFamilyValueCache = HeapHashMap<String, Member<CSSCustomIdentValue>
>; |
| 90 FontFamilyValueCache m_fontFamilyValueCache; | 89 FontFamilyValueCache m_fontFamilyValueCache; |
| 91 | 90 |
| 92 friend CORE_EXPORT CSSValuePool& cssValuePool(); | 91 friend CORE_EXPORT CSSValuePool& cssValuePool(); |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 CORE_EXPORT CSSValuePool& cssValuePool(); | 94 CORE_EXPORT CSSValuePool& cssValuePool(); |
| 96 | 95 |
| 97 } // namespace blink | 96 } // namespace blink |
| 98 | 97 |
| 99 #endif | 98 #endif |
| OLD | NEW |