| Index: Source/core/css/StylePropertySet.cpp
|
| diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
|
| index c1e5893137ce023448a6eafc49d029ed8e6cedc3..2d635dc4f0b1a33f356779409fd380d10e08233b 100644
|
| --- a/Source/core/css/StylePropertySet.cpp
|
| +++ b/Source/core/css/StylePropertySet.cpp
|
| @@ -50,8 +50,12 @@ static size_t sizeForImmutableStylePropertySetWithPropertyCount(unsigned count)
|
| PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
|
| {
|
| ASSERT(count <= MaxArraySize);
|
| +#if ENABLE(OILPAN)
|
| + void* slot = Heap::allocate<StylePropertySet>(sizeForImmutableStylePropertySetWithPropertyCount(count));
|
| +#else
|
| void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCount(count));
|
| - return adoptRef(new (slot) ImmutableStylePropertySet(properties, count, cssParserMode));
|
| +#endif // ENABLE(OILPAN)
|
| + return adoptRefWillBeRefCountedGarbageCollected(new (slot) ImmutableStylePropertySet(properties, count, cssParserMode));
|
| }
|
|
|
| PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded() const
|
| @@ -79,7 +83,7 @@ ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti
|
| : StylePropertySet(cssParserMode, length)
|
| {
|
| StylePropertyMetadata* metadataArray = const_cast<StylePropertyMetadata*>(this->metadataArray());
|
| - CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray());
|
| + RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSSValue>*>(this->valueArray());
|
| for (unsigned i = 0; i < m_arraySize; ++i) {
|
| metadataArray[i] = properties[i].metadata();
|
| valueArray[i] = properties[i].value();
|
| @@ -87,12 +91,14 @@ ImmutableStylePropertySet::ImmutableStylePropertySet(const CSSProperty* properti
|
| }
|
| }
|
|
|
| +#if !ENABLE(OILPAN)
|
| ImmutableStylePropertySet::~ImmutableStylePropertySet()
|
| {
|
| - CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray());
|
| + RawPtrWillBeMember<CSSValue>* valueArray = const_cast<RawPtrWillBeMember<CSSValue>*>(this->valueArray());
|
| for (unsigned i = 0; i < m_arraySize; ++i)
|
| valueArray[i]->deref();
|
| }
|
| +#endif
|
|
|
| int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const
|
| {
|
| @@ -110,6 +116,14 @@ int ImmutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const
|
| return -1;
|
| }
|
|
|
| +void ImmutableStylePropertySet::traceAfterDispatch(Visitor* visitor)
|
| +{
|
| + const RawPtrWillBeMember<CSSValue>* values = valueArray();
|
| + for (unsigned i = 0; i < m_arraySize; i++)
|
| + visitor->trace(values[i]);
|
| + StylePropertySet::traceAfterDispatch(visitor);
|
| +}
|
| +
|
| MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other)
|
| : StylePropertySet(other.cssParserMode())
|
| {
|
| @@ -139,6 +153,14 @@ PassRefPtrWillBeRawPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSProper
|
| return propertyAt(foundPropertyIndex).value();
|
| }
|
|
|
| +void StylePropertySet::trace(Visitor* visitor)
|
| +{
|
| + if (m_isMutable)
|
| + toMutableStylePropertySet(this)->traceAfterDispatch(visitor);
|
| + else
|
| + toImmutableStylePropertySet(this)->traceAfterDispatch(visitor);
|
| +}
|
| +
|
| bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
|
| {
|
| StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
|
| @@ -319,7 +341,7 @@ void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
|
| parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet);
|
| }
|
|
|
| -void MutableStylePropertySet::addParsedProperties(const Vector<CSSProperty, 256>& properties)
|
| +void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProperty, 256>& properties)
|
| {
|
| m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size());
|
| for (unsigned i = 0; i < properties.size(); ++i)
|
| @@ -419,7 +441,7 @@ bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un
|
| for (unsigned i = 0; i < length; ++i)
|
| toRemove.add(set[i]);
|
|
|
| - Vector<CSSProperty> newProperties;
|
| + WillBeHeapVector<CSSProperty> newProperties;
|
| newProperties.reserveInitialCapacity(m_propertyVector.size());
|
|
|
| unsigned size = m_propertyVector.size();
|
| @@ -484,12 +506,12 @@ void MutableStylePropertySet::removeEquivalentProperties(const CSSStyleDeclarati
|
|
|
| PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const
|
| {
|
| - return adoptRef(new MutableStylePropertySet(*this));
|
| + return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(*this));
|
| }
|
|
|
| PassRefPtr<MutableStylePropertySet> StylePropertySet::copyPropertiesInSet(const Vector<CSSPropertyID>& properties) const
|
| {
|
| - Vector<CSSProperty, 256> list;
|
| + WillBeHeapVector<CSSProperty, 256> list;
|
| list.reserveInitialCapacity(properties.size());
|
| for (unsigned i = 0; i < properties.size(); ++i) {
|
| RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(properties[i]);
|
| @@ -528,6 +550,12 @@ int MutableStylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const
|
| return -1;
|
| }
|
|
|
| +void MutableStylePropertySet::traceAfterDispatch(Visitor* visitor)
|
| +{
|
| + visitor->trace(m_propertyVector);
|
| + StylePropertySet::traceAfterDispatch(visitor);
|
| +}
|
| +
|
| unsigned StylePropertySet::averageSizeInBytes()
|
| {
|
| // Please update this if the storage scheme changes so that this longer reflects the actual size.
|
| @@ -535,7 +563,7 @@ unsigned StylePropertySet::averageSizeInBytes()
|
| }
|
|
|
| // See the function above if you need to update this.
|
| -struct SameSizeAsStylePropertySet : public RefCounted<SameSizeAsStylePropertySet> {
|
| +struct SameSizeAsStylePropertySet : public RefCountedWillBeRefCountedGarbageCollected<SameSizeAsStylePropertySet> {
|
| unsigned bitfield;
|
| };
|
| COMPILE_ASSERT(sizeof(StylePropertySet) == sizeof(SameSizeAsStylePropertySet), style_property_set_should_stay_small);
|
| @@ -549,12 +577,12 @@ void StylePropertySet::showStyle()
|
|
|
| PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(CSSParserMode cssParserMode)
|
| {
|
| - return adoptRef(new MutableStylePropertySet(cssParserMode));
|
| + return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(cssParserMode));
|
| }
|
|
|
| PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSProperty* properties, unsigned count)
|
| {
|
| - return adoptRef(new MutableStylePropertySet(properties, count));
|
| + return adoptRefWillBeRefCountedGarbageCollected(new MutableStylePropertySet(properties, count));
|
| }
|
|
|
| String StylePropertySet::PropertyReference::cssName() const
|
|
|