OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "core/CoreExport.h" | 24 #include "core/CoreExport.h" |
25 #include "platform/heap/Handle.h" | 25 #include "platform/heap/Handle.h" |
26 #include "platform/weborigin/KURL.h" | 26 #include "platform/weborigin/KURL.h" |
27 #include "wtf/HashMap.h" | 27 #include "wtf/HashMap.h" |
28 #include "wtf/ListHashSet.h" | 28 #include "wtf/ListHashSet.h" |
29 #include "wtf/RefCounted.h" | 29 #include "wtf/RefCounted.h" |
30 #include "wtf/RefPtr.h" | 30 #include "wtf/RefPtr.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class CORE_EXPORT CSSValue : public RefCountedWillBeGarbageCollectedFinalized<CS
SValue> { | 34 class CORE_EXPORT CSSValue : public RefCounted<CSSValue> { |
35 public: | 35 public: |
36 #if ENABLE(OILPAN) | |
37 // Override operator new to allocate CSSValue subtype objects onto | |
38 // a dedicated heap. | |
39 GC_PLUGIN_IGNORE("crbug.com/443854") | |
40 void* operator new(size_t size) | |
41 { | |
42 return allocateObject(size, false); | |
43 } | |
44 static void* allocateObject(size_t size, bool isEager) | |
45 { | |
46 ThreadState* state = ThreadStateFor<ThreadingTrait<CSSValue>::Affinity>:
:state(); | |
47 return Heap::allocateOnHeapIndex(state, size, isEager ? ThreadState::Eag
erSweepHeapIndex : ThreadState::CSSValueHeapIndex, GCInfoTrait<CSSValue>::index(
)); | |
48 } | |
49 #else | |
50 // Override RefCounted's deref() to ensure operator delete is called on | 36 // Override RefCounted's deref() to ensure operator delete is called on |
51 // the appropriate subclass type. | 37 // the appropriate subclass type. |
52 void deref() | 38 void deref() |
53 { | 39 { |
54 if (derefBase()) | 40 if (derefBase()) |
55 destroy(); | 41 destroy(); |
56 } | 42 } |
57 #endif // !ENABLE(OILPAN) | |
58 | 43 |
59 String cssText() const; | 44 String cssText() const; |
60 | 45 |
61 bool isPrimitiveValue() const { return m_classType == PrimitiveClass; } | 46 bool isPrimitiveValue() const { return m_classType == PrimitiveClass; } |
62 bool isValueList() const { return m_classType >= ValueListClass; } | 47 bool isValueList() const { return m_classType >= ValueListClass; } |
63 | 48 |
64 bool isBaseValueList() const { return m_classType == ValueListClass; } | 49 bool isBaseValueList() const { return m_classType == ValueListClass; } |
65 | 50 |
66 bool isBorderImageSliceValue() const { return m_classType == BorderImageSlic
eClass; } | 51 bool isBorderImageSliceValue() const { return m_classType == BorderImageSlic
eClass; } |
67 bool isCanvasValue() const { return m_classType == CanvasClass; } | 52 bool isCanvasValue() const { return m_classType == CanvasClass; } |
(...skipping 24 matching lines...) Expand all Loading... |
92 bool isSVGDocumentValue() const { return m_classType == CSSSVGDocumentClass;
} | 77 bool isSVGDocumentValue() const { return m_classType == CSSSVGDocumentClass;
} |
93 bool isContentDistributionValue() const { return m_classType == CSSContentDi
stributionClass; } | 78 bool isContentDistributionValue() const { return m_classType == CSSContentDi
stributionClass; } |
94 bool isUnicodeRangeValue() const { return m_classType == UnicodeRangeClass;
} | 79 bool isUnicodeRangeValue() const { return m_classType == UnicodeRangeClass;
} |
95 bool isGridLineNamesValue() const { return m_classType == GridLineNamesClass
; } | 80 bool isGridLineNamesValue() const { return m_classType == GridLineNamesClass
; } |
96 | 81 |
97 bool hasFailedOrCanceledSubresources() const; | 82 bool hasFailedOrCanceledSubresources() const; |
98 | 83 |
99 bool equals(const CSSValue&) const; | 84 bool equals(const CSSValue&) const; |
100 | 85 |
101 void finalizeGarbageCollectedObject(); | 86 void finalizeGarbageCollectedObject(); |
102 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } | |
103 DECLARE_TRACE(); | |
104 | 87 |
105 // ~CSSValue should be public, because non-public ~CSSValue causes C2248 | 88 // ~CSSValue should be public, because non-public ~CSSValue causes C2248 |
106 // error: 'blink::CSSValue::~CSSValue' : cannot access protected member | 89 // error: 'blink::CSSValue::~CSSValue' : cannot access protected member |
107 // declared in class 'blink::CSSValue' when compiling | 90 // declared in class 'blink::CSSValue' when compiling |
108 // 'source\wtf\refcounted.h' by using msvc. | 91 // 'source\wtf\refcounted.h' by using msvc. |
109 ~CSSValue() { } | 92 ~CSSValue() { } |
110 | 93 |
111 protected: | 94 protected: |
112 | 95 |
113 static const size_t ClassTypeBits = 6; | 96 static const size_t ClassTypeBits = 6; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 mutable unsigned m_hasCachedCSSText : 1; | 174 mutable unsigned m_hasCachedCSSText : 1; |
192 unsigned m_isQuirkValue : 1; | 175 unsigned m_isQuirkValue : 1; |
193 | 176 |
194 unsigned m_valueListSeparator : ValueListSeparatorBits; | 177 unsigned m_valueListSeparator : ValueListSeparatorBits; |
195 | 178 |
196 private: | 179 private: |
197 unsigned m_classType : ClassTypeBits; // ClassType | 180 unsigned m_classType : ClassTypeBits; // ClassType |
198 }; | 181 }; |
199 | 182 |
200 template<typename CSSValueType, size_t inlineCapacity> | 183 template<typename CSSValueType, size_t inlineCapacity> |
201 inline bool compareCSSValueVector(const WillBeHeapVector<RefPtrWillBeMember<CSSV
alueType>, inlineCapacity>& firstVector, const WillBeHeapVector<RefPtrWillBeMemb
er<CSSValueType>, inlineCapacity>& secondVector) | 184 inline bool compareCSSValueVector(const Vector<RefPtr<CSSValueType>, inlineCapac
ity>& firstVector, const Vector<RefPtr<CSSValueType>, inlineCapacity>& secondVec
tor) |
202 { | 185 { |
203 size_t size = firstVector.size(); | 186 size_t size = firstVector.size(); |
204 if (size != secondVector.size()) | 187 if (size != secondVector.size()) |
205 return false; | 188 return false; |
206 | 189 |
207 for (size_t i = 0; i < size; i++) { | 190 for (size_t i = 0; i < size; i++) { |
208 const RefPtrWillBeMember<CSSValueType>& firstPtr = firstVector[i]; | 191 const RefPtr<CSSValueType>& firstPtr = firstVector[i]; |
209 const RefPtrWillBeMember<CSSValueType>& secondPtr = secondVector[i]; | 192 const RefPtr<CSSValueType>& secondPtr = secondVector[i]; |
210 if (firstPtr == secondPtr || (firstPtr && secondPtr && firstPtr->equals(
*secondPtr))) | 193 if (firstPtr == secondPtr || (firstPtr && secondPtr && firstPtr->equals(
*secondPtr))) |
211 continue; | 194 continue; |
212 return false; | 195 return false; |
213 } | 196 } |
214 return true; | 197 return true; |
215 } | 198 } |
216 | 199 |
217 template<typename CSSValueType> | 200 template<typename CSSValueType> |
218 inline bool compareCSSValuePtr(const RefPtr<CSSValueType>& first, const RefPtr<C
SSValueType>& second) | 201 inline bool compareCSSValuePtr(const RefPtr<CSSValueType>& first, const RefPtr<C
SSValueType>& second) |
219 { | 202 { |
(...skipping 23 matching lines...) Expand all Loading... |
243 return false; | 226 return false; |
244 return first->equals(*second); | 227 return first->equals(*second); |
245 } | 228 } |
246 | 229 |
247 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \ | 230 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \ |
248 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predica
te) | 231 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predica
te) |
249 | 232 |
250 } // namespace blink | 233 } // namespace blink |
251 | 234 |
252 #endif // CSSValue_h | 235 #endif // CSSValue_h |
OLD | NEW |