Chromium Code Reviews| Index: Source/core/css/CSSGradientValue.cpp |
| diff --git a/Source/core/css/CSSGradientValue.cpp b/Source/core/css/CSSGradientValue.cpp |
| index 59aa9420fd79ba6fd62225e48583cc729b9cc689..7830aeae52f7f0f0a41d2781cb1704b6bd4c4654 100644 |
| --- a/Source/core/css/CSSGradientValue.cpp |
| +++ b/Source/core/css/CSSGradientValue.cpp |
| @@ -101,7 +101,9 @@ void CSSGradientValue::sortStopsIfNeeded() |
| } |
| } |
| -struct GradientStop { |
| +class GradientStop { |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
|
sof
2014/10/09 15:10:36
We could leave this out, not sure it is worth it.
sof
2014/10/09 15:32:20
Landing now to heal the tree. If preferable withou
|
| +public: |
| Color color; |
| float offset; |
| bool specified; |
| @@ -112,6 +114,22 @@ struct GradientStop { |
| { } |
| }; |
| +} // namespace blink |
| + |
| +// Escape out and declare VectorTraits for GradientStop before it is used |
| +// in a HeapVector with an inline capacity. |
| +namespace WTF { |
| + |
| +template<> |
| +struct VectorTraits<blink::GradientStop> : SimpleClassVectorTraits<blink::GradientStop> { |
|
haraken
2014/10/09 15:05:35
Can we use WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS inste
sof
2014/10/09 15:10:36
The needsDestruction override is needed, unfortuna
|
| + // IsPod<> doesn't handle embedded structs/enums (e.g., Color.) |
| + static const bool needsDestruction = false; |
| +}; |
| + |
| +} // namespace WTF |
| + |
| +namespace blink { |
| + |
| PassRefPtrWillBeRawPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(const TextLinkColors& textLinkColors, Color currentColor) |
| { |
| bool derived = false; |
| @@ -143,7 +161,7 @@ PassRefPtrWillBeRawPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesRes |
| return result.release(); |
| } |
| -static void replaceColorHintsWithColorStops(Vector<GradientStop>& stops, const Vector<CSSGradientColorStop, 2>& cssGradientStops) |
| +static void replaceColorHintsWithColorStops(WillBeHeapVector<GradientStop>& stops, const WillBeHeapVector<CSSGradientColorStop, 2>& cssGradientStops) |
| { |
| // This algorithm will replace each color interpolation hint with 9 regular |
| // color stops. The color values for the new color stops will be calculated |
| @@ -253,7 +271,7 @@ void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionD |
| size_t numStops = m_stops.size(); |
| - Vector<GradientStop> stops(numStops); |
| + WillBeHeapVector<GradientStop> stops(numStops); |
| float gradientLength = 0; |
| bool computedGradientLength = false; |