Index: Source/core/css/StylePropertySet.h |
diff --git a/Source/core/css/StylePropertySet.h b/Source/core/css/StylePropertySet.h |
index 50087aa3b2e7c5ba6c934eadbee7723791eb94db..549cc9888c47fba3738fb999e6691c980e266210 100644 |
--- a/Source/core/css/StylePropertySet.h |
+++ b/Source/core/css/StylePropertySet.h |
@@ -41,12 +41,20 @@ class MutableStylePropertySet; |
class StylePropertyShorthand; |
class StyleSheetContents; |
-class StylePropertySet : public RefCounted<StylePropertySet> { |
+class StylePropertySet : public RefCountedWillBeRefCountedGarbageCollected<StylePropertySet> { |
friend class PropertyReference; |
public: |
+ |
+#if ENABLE(OILPAN) |
+ // When oilpan is enabled override the finalize method to dispatch to the subclasses' |
+ // destructor. This can be removed once the MutableStylePropertySet's OwnPtr is moved |
+ // to the heap. |
+ void finalize(); |
+#else |
// Override RefCounted's deref() to ensure operator delete is called on |
// the appropriate subclass type. |
void deref(); |
+#endif |
class PropertyReference { |
public: |
@@ -117,6 +125,9 @@ public: |
bool propertyMatches(CSSPropertyID, const CSSValue*) const; |
+ void trace(Visitor*); |
+ void traceAfterDispatch(Visitor*) { } |
+ |
protected: |
enum { MaxArraySize = (1 << 28) - 1 }; |
@@ -147,24 +158,31 @@ public: |
unsigned propertyCount() const { return m_arraySize; } |
- const CSSValue** valueArray() const; |
+ const RawPtrWillBeMember<CSSValue>* valueArray() const; |
const StylePropertyMetadata* metadataArray() const; |
int findPropertyIndex(CSSPropertyID) const; |
+ void traceAfterDispatch(Visitor*); |
+ |
+ void* operator new(std::size_t, void* location) |
+ { |
+ return location; |
+ } |
+ |
void* m_storage; |
private: |
ImmutableStylePropertySet(const CSSProperty*, unsigned count, CSSParserMode); |
}; |
-inline const CSSValue** ImmutableStylePropertySet::valueArray() const |
+inline const RawPtrWillBeMember<CSSValue>* ImmutableStylePropertySet::valueArray() const |
{ |
- return reinterpret_cast<const CSSValue**>(const_cast<const void**>(&(this->m_storage))); |
+ return reinterpret_cast<const RawPtrWillBeMember<CSSValue>*>(const_cast<const void**>(&(this->m_storage))); |
} |
inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() const |
{ |
- return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<const char*>(&(this->m_storage))[m_arraySize * sizeof(CSSValue*)]); |
+ return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<const char*>(&(this->m_storage))[m_arraySize * sizeof(RawPtrWillBeMember<CSSValue>)]); |
} |
DEFINE_TYPE_CASTS(ImmutableStylePropertySet, StylePropertySet, set, !set->isMutable(), !set.isMutable()); |
@@ -182,7 +200,7 @@ public: |
unsigned propertyCount() const { return m_propertyVector.size(); } |
- void addParsedProperties(const Vector<CSSProperty, 256>&); |
+ void addParsedProperties(const WillBeHeapVector<CSSProperty, 256>&); |
void addParsedProperty(const CSSProperty&); |
// These expand shorthand properties into multiple properties. |
@@ -211,6 +229,8 @@ public: |
CSSStyleDeclaration* ensureCSSStyleDeclaration(); |
int findPropertyIndex(CSSPropertyID) const; |
+ void traceAfterDispatch(Visitor*); |
+ |
private: |
explicit MutableStylePropertySet(CSSParserMode); |
explicit MutableStylePropertySet(const StylePropertySet&); |
@@ -222,7 +242,7 @@ private: |
friend class StylePropertySet; |
- Vector<CSSProperty, 4> m_propertyVector; |
+ WillBeHeapVector<CSSProperty, 4> m_propertyVector; |
}; |
DEFINE_TYPE_CASTS(MutableStylePropertySet, StylePropertySet, set, set->isMutable(), set.isMutable()); |
@@ -258,6 +278,7 @@ inline bool StylePropertySet::isEmpty() const |
return !propertyCount(); |
} |
+#if !ENABLE(OILPAN) |
inline void StylePropertySet::deref() |
{ |
if (!derefBase()) |
@@ -268,6 +289,7 @@ inline void StylePropertySet::deref() |
else |
delete toImmutableStylePropertySet(this); |
} |
+#endif // !ENABLE(OILPAN) |
inline int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const |
{ |