Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: Source/core/css/CSSGradientValue.h

Issue 148523016: Move most of the [Pass]RefPtr's of CSSPrimitiveValue to our transition types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSGradientValue.h
diff --git a/Source/core/css/CSSGradientValue.h b/Source/core/css/CSSGradientValue.h
index 9d13795d83e75f77dec805cc8818c8226b66ed31..9c236a18cb4f94990ec32eea66b9368ed9d947ca 100644
--- a/Source/core/css/CSSGradientValue.h
+++ b/Source/core/css/CSSGradientValue.h
@@ -47,10 +47,14 @@ enum CSSGradientType {
};
enum CSSGradientRepeat { NonRepeating, Repeating };
+// This struct is stack allocated and allocated as part of vectors.
+// When allocated on the stack its members are found by conservative
+// stack scanning. When allocated as part of Vectors in heap-allocated
+// objects its members are visited via the traceAfterDispatch method.
haraken 2014/02/12 14:05:45 traceAfterDispatch => trace
wibling-chromium 2014/02/12 14:42:19 I meant the traceAfterDispatch method of the conta
struct CSSGradientColorStop {
zerny-chromium 2014/02/12 14:10:44 Add DISALLOW_ALLOCATION
wibling-chromium 2014/02/12 14:42:19 I have added ALLOW_ONLY_INLINE_ALLOCATION since it
CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { };
- RefPtr<CSSPrimitiveValue> m_position; // percentage or length
- RefPtr<CSSPrimitiveValue> m_color;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_position; // percentage or length
+ RefPtrWillBeMember<CSSPrimitiveValue> m_color;
Color m_resolvedColor;
bool m_colorIsDerivedFromElement;
bool operator==(const CSSGradientColorStop& other) const
@@ -58,16 +62,18 @@ struct CSSGradientColorStop {
return compareCSSValuePtr(m_color, other.m_color)
&& compareCSSValuePtr(m_position, other.m_position);
}
+
+ void trace(Visitor*);
haraken 2014/02/12 14:05:45 Just to confirm: If we forget to declare trace(),
wibling-chromium 2014/02/12 14:42:19 It does get caught, but only when compiling with e
};
class CSSGradientValue : public CSSImageGeneratorValue {
public:
PassRefPtr<Image> image(RenderObject*, const IntSize&);
- void setFirstX(PassRefPtr<CSSPrimitiveValue> val) { m_firstX = val; }
- void setFirstY(PassRefPtr<CSSPrimitiveValue> val) { m_firstY = val; }
- void setSecondX(PassRefPtr<CSSPrimitiveValue> val) { m_secondX = val; }
- void setSecondY(PassRefPtr<CSSPrimitiveValue> val) { m_secondY = val; }
+ void setFirstX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstX = val; }
+ void setFirstY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstY = val; }
+ void setSecondX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondX = val; }
+ void setSecondY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondY = val; }
void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); }
@@ -120,14 +126,14 @@ protected:
bool isCacheable() const;
// Points. Some of these may be null.
- RefPtr<CSSPrimitiveValue> m_firstX;
- RefPtr<CSSPrimitiveValue> m_firstY;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_firstX;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_firstY;
- RefPtr<CSSPrimitiveValue> m_secondX;
- RefPtr<CSSPrimitiveValue> m_secondY;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_secondX;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_secondY;
// Stops
- Vector<CSSGradientColorStop, 2> m_stops;
+ WillBeHeapVector<CSSGradientColorStop, 2> m_stops;
bool m_stopsSorted;
CSSGradientType m_gradientType;
bool m_repeating;
@@ -143,7 +149,7 @@ public:
return adoptRefCountedWillBeRefCountedGarbageCollected(new CSSLinearGradientValue(repeat, gradientType));
}
- void setAngle(PassRefPtr<CSSPrimitiveValue> val) { m_angle = val; }
+ void setAngle(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_angle = val; }
String customCSSText() const;
@@ -171,7 +177,7 @@ private:
{
}
- RefPtr<CSSPrimitiveValue> m_angle; // may be null.
+ RefPtrWillBeMember<CSSPrimitiveValue> m_angle; // may be null.
};
DEFINE_CSS_VALUE_TYPE_CASTS(CSSLinearGradientValue, isLinearGradientValue());
@@ -190,14 +196,14 @@ public:
String customCSSText() const;
- void setFirstRadius(PassRefPtr<CSSPrimitiveValue> val) { m_firstRadius = val; }
- void setSecondRadius(PassRefPtr<CSSPrimitiveValue> val) { m_secondRadius = val; }
+ void setFirstRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstRadius = val; }
+ void setSecondRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondRadius = val; }
- void setShape(PassRefPtr<CSSPrimitiveValue> val) { m_shape = val; }
- void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior = val; }
+ void setShape(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_shape = val; }
+ void setSizingBehavior(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_sizingBehavior = val; }
- void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizontalSize = val; }
- void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSize = val; }
+ void setEndHorizontalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_endHorizontalSize = val; }
+ void setEndVerticalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_endVerticalSize = val; }
// Create the gradient for a given size.
PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&);
@@ -228,15 +234,15 @@ private:
float resolveRadius(CSSPrimitiveValue*, const CSSToLengthConversionData&, float* widthOrHeight = 0);
// These may be null for non-deprecated gradients.
- RefPtr<CSSPrimitiveValue> m_firstRadius;
- RefPtr<CSSPrimitiveValue> m_secondRadius;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_firstRadius;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_secondRadius;
// The below are only used for non-deprecated gradients. Any of them may be null.
- RefPtr<CSSPrimitiveValue> m_shape;
- RefPtr<CSSPrimitiveValue> m_sizingBehavior;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_shape;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_sizingBehavior;
- RefPtr<CSSPrimitiveValue> m_endHorizontalSize;
- RefPtr<CSSPrimitiveValue> m_endVerticalSize;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize;
};
DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue());

Powered by Google App Engine
This is Rietveld 408576698