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

Unified Diff: Source/core/html/canvas/CanvasStyle.h

Issue 365653002: Oilpan: move 2D Canvas and WebGL objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Smaller adjustments Created 6 years, 5 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/html/canvas/CanvasStyle.h
diff --git a/Source/core/html/canvas/CanvasStyle.h b/Source/core/html/canvas/CanvasStyle.h
index 2b2eb4df728972a3dc1f5a33ba456b43c8fdfc08..969258663dbc7ad6539686d1c538f743345aa29f 100644
--- a/Source/core/html/canvas/CanvasStyle.h
+++ b/Source/core/html/canvas/CanvasStyle.h
@@ -28,6 +28,7 @@
#define CanvasStyle_h
#include "platform/graphics/Color.h"
+#include "platform/heap/Handle.h"
#include "wtf/Assertions.h"
#include "wtf/RefCounted.h"
#include "wtf/text/WTFString.h"
@@ -39,16 +40,16 @@ namespace blink {
class GraphicsContext;
class HTMLCanvasElement;
- class CanvasStyle : public RefCounted<CanvasStyle> {
+ class CanvasStyle FINAL : public RefCountedWillBeGarbageCollected<CanvasStyle> {
public:
- static PassRefPtr<CanvasStyle> createFromRGBA(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); }
- static PassRefPtr<CanvasStyle> createFromString(const String& color);
- static PassRefPtr<CanvasStyle> createFromStringWithOverrideAlpha(const String& color, float alpha);
- static PassRefPtr<CanvasStyle> createFromGrayLevelWithAlpha(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); }
- static PassRefPtr<CanvasStyle> createFromRGBAChannels(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); }
- static PassRefPtr<CanvasStyle> createFromCMYKAChannels(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); }
- static PassRefPtr<CanvasStyle> createFromGradient(PassRefPtr<CanvasGradient>);
- static PassRefPtr<CanvasStyle> createFromPattern(PassRefPtr<CanvasPattern>);
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromRGBA(RGBA32 rgba) { return adoptRefWillBeNoop(new CanvasStyle(rgba)); }
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromString(const String& color);
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromStringWithOverrideAlpha(const String& color, float alpha);
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromGrayLevelWithAlpha(float grayLevel, float alpha) { return adoptRefWillBeNoop(new CanvasStyle(grayLevel, alpha)); }
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromRGBAChannels(float r, float g, float b, float a) { return adoptRefWillBeNoop(new CanvasStyle(r, g, b, a)); }
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromCMYKAChannels(float c, float m, float y, float k, float a) { return adoptRefWillBeNoop(new CanvasStyle(c, m, y, k, a)); }
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromGradient(PassRefPtrWillBeRawPtr<CanvasGradient>);
+ static PassRefPtrWillBeRawPtr<CanvasStyle> createFromPattern(PassRefPtrWillBeRawPtr<CanvasPattern>);
bool isCurrentColor() const { return m_type == CurrentColor || m_type == CurrentColorWithOverrideAlpha; }
bool hasOverrideAlpha() const { return m_type == CurrentColorWithOverrideAlpha; }
@@ -65,6 +66,8 @@ namespace blink {
bool isEquivalentRGBA(float r, float g, float b, float a) const;
bool isEquivalentCMYKA(float c, float m, float y, float k, float a) const;
+ void trace(Visitor*);
+
private:
enum Type { RGBA, CMYKA, Gradient, ImagePattern, CurrentColor, CurrentColorWithOverrideAlpha };
@@ -73,8 +76,8 @@ namespace blink {
CanvasStyle(float grayLevel, float alpha);
CanvasStyle(float r, float g, float b, float a);
CanvasStyle(float c, float m, float y, float k, float a);
- CanvasStyle(PassRefPtr<CanvasGradient>);
- CanvasStyle(PassRefPtr<CanvasPattern>);
+ CanvasStyle(PassRefPtrWillBeRawPtr<CanvasGradient>);
+ CanvasStyle(PassRefPtrWillBeRawPtr<CanvasPattern>);
Type m_type;
@@ -83,8 +86,8 @@ namespace blink {
float m_overrideAlpha;
};
- RefPtr<CanvasGradient> m_gradient;
- RefPtr<CanvasPattern> m_pattern;
+ RefPtrWillBeMember<CanvasGradient> m_gradient;
+ RefPtrWillBeMember<CanvasPattern> m_pattern;
struct CMYKAValues {
CMYKAValues() : c(0), m(0), y(0), k(0), a(0) { }

Powered by Google App Engine
This is Rietveld 408576698