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

Side by Side Diff: Source/core/html/canvas/Path2D.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef Path2D_h 28 #ifndef Path2D_h
29 #define Path2D_h 29 #define Path2D_h
30 30
31 #include "bindings/core/v8/ScriptWrappable.h" 31 #include "bindings/core/v8/ScriptWrappable.h"
32 #include "core/html/canvas/CanvasPathMethods.h" 32 #include "core/html/canvas/CanvasPathMethods.h"
33 #include "core/svg/SVGMatrixTearOff.h" 33 #include "core/svg/SVGMatrixTearOff.h"
34 #include "core/svg/SVGPathUtilities.h" 34 #include "core/svg/SVGPathUtilities.h"
35 #include "platform/heap/Handle.h"
35 #include "platform/transforms/AffineTransform.h" 36 #include "platform/transforms/AffineTransform.h"
36 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
37 #include "wtf/RefCounted.h" 38 #include "wtf/RefCounted.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 class Path2D FINAL : public RefCounted<Path2D>, public CanvasPathMethods, public ScriptWrappable { 42 class Path2D FINAL : public RefCountedWillBeGarbageCollectedFinalized<Path2D>, p ublic CanvasPathMethods, public ScriptWrappable {
42 WTF_MAKE_NONCOPYABLE(Path2D); WTF_MAKE_FAST_ALLOCATED; 43 WTF_MAKE_NONCOPYABLE(Path2D); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
43 public: 44 public:
44 static PassRefPtr<Path2D> create() { return adoptRef(new Path2D); } 45 static PassRefPtrWillBeRawPtr<Path2D> create() { return adoptRefWillBeNoop(n ew Path2D); }
45 static PassRefPtr<Path2D> create(const String& pathData) { return adoptRef(n ew Path2D(pathData)); } 46 static PassRefPtrWillBeRawPtr<Path2D> create(const String& pathData) { retur n adoptRefWillBeNoop(new Path2D(pathData)); }
46 static PassRefPtr<Path2D> create(Path2D* path) { return adoptRef(new Path2D( path)); } 47 static PassRefPtrWillBeRawPtr<Path2D> create(Path2D* path) { return adoptRef WillBeNoop(new Path2D(path)); }
47 48
48 static PassRefPtr<Path2D> create(const Path& path) { return adoptRef(new Pat h2D(path)); } 49 static PassRefPtrWillBeRawPtr<Path2D> create(const Path& path) { return adop tRefWillBeNoop(new Path2D(path)); }
49 50
50 const Path& path() const { return m_path; } 51 const Path& path() const { return m_path; }
51 52
52 void addPath(Path2D* path) 53 void addPath(Path2D* path)
53 { 54 {
54 addPath(path, 0); 55 addPath(path, 0);
55 } 56 }
56 57
57 void addPath(Path2D* path, SVGMatrixTearOff* transform) 58 void addPath(Path2D* path, SVGMatrixTearOff* transform)
58 { 59 {
59 Path src = path->path(); 60 Path src = path->path();
60 m_path.addPath(src, transform ? transform->value() : AffineTransform(1, 0, 0, 1, 0, 0)); 61 m_path.addPath(src, transform ? transform->value() : AffineTransform(1, 0, 0, 1, 0, 0));
61 } 62 }
63
62 virtual ~Path2D() { } 64 virtual ~Path2D() { }
65 void trace(Visitor*) { }
66
63 private: 67 private:
64 Path2D() : CanvasPathMethods() 68 Path2D() : CanvasPathMethods()
65 { 69 {
66 ScriptWrappable::init(this); 70 ScriptWrappable::init(this);
67 } 71 }
68 72
69 Path2D(const Path& path) 73 Path2D(const Path& path)
70 : CanvasPathMethods(path) 74 : CanvasPathMethods(path)
71 { 75 {
72 ScriptWrappable::init(this); 76 ScriptWrappable::init(this);
73 } 77 }
74 78
75 Path2D(Path2D* path) 79 Path2D(Path2D* path)
76 : CanvasPathMethods(path->path()) 80 : CanvasPathMethods(path->path())
77 { 81 {
78 ScriptWrappable::init(this); 82 ScriptWrappable::init(this);
79 } 83 }
80 84
81 Path2D(const String& pathData) 85 Path2D(const String& pathData)
82 : CanvasPathMethods() 86 : CanvasPathMethods()
83 { 87 {
84 ScriptWrappable::init(this); 88 ScriptWrappable::init(this);
85 buildPathFromString(pathData, m_path); 89 buildPathFromString(pathData, m_path);
86 } 90 }
87 }; 91 };
88 92
89 } 93 }
90 #endif 94 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698