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

Unified Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h

Issue 1407543003: Preliminary paint property walk implementation for SPv2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
index 5bce0886dd627a31c625c2b97bb204dfc29e7108..5708d1e51fe40a4cc0dfd46f2f6132fbd24a86bb 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -6,6 +6,9 @@
#define ObjectPaintProperties_h
#include "platform/graphics/paint/TransformPaintPropertyNode.h"
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
@@ -24,24 +27,38 @@ class ObjectPaintProperties {
WTF_MAKE_NONCOPYABLE(ObjectPaintProperties);
WTF_MAKE_FAST_ALLOCATED(ObjectPaintProperties);
public:
+ // This is intended to be inherited by FrameView and LayoutObject to hold ownership to
+ // ObjectPaintProperties. Ideally we should simply use an OwnPtr but at this moment we
+ // use a global HashMap to avoid regressing non-SPv2 memory use. Thus we need this class
+ // to maintain RAII.
+ class Owner {
jbroman 2015/10/14 15:11:58 So this exists because we don't want to pay sizeof
pdr. 2015/10/14 17:52:06 I like your approach of putting these functions on
trchen 2015/10/14 22:51:13 This is because LayoutSVGModelObject can't have la
+ public:
+ ObjectPaintProperties* objectPaintProperties() const;
+ ObjectPaintProperties& ensureObjectPaintProperties();
+ void setObjectPaintProperties(PassOwnPtr<ObjectPaintProperties>);
jbroman 2015/10/14 15:11:58 It looks like this is only used for clearing. If s
trchen 2015/10/14 22:51:13 Makes sense. Done.
+ protected:
+ ~Owner();
+ private:
+ typedef HashMap<const ObjectPaintProperties::Owner*, OwnPtr<ObjectPaintProperties>> NodeMapping;
pdr. 2015/10/14 17:52:06 For now, I think we can increase the size of Paint
trchen 2015/10/14 22:51:13 See explanation above.
+ static NodeMapping* s_nodeMapping;
+ };
+
static PassOwnPtr<ObjectPaintProperties> create()
{
return adoptPtr(new ObjectPaintProperties());
}
- bool hasTransform() const { return m_transform; }
- void setTransform(PassRefPtr<TransformPaintPropertyNode> transform) { m_transform = transform; }
- const TransformPaintPropertyNode* transform() const { return m_transform.get(); }
+ void setTransformNodeForSelf(PassRefPtr<TransformPaintPropertyNode> node) { m_transformNodeForSelf = node; }
jbroman 2015/10/14 15:11:58 Any reason to make this more abstract? For Depreca
pdr. 2015/10/14 17:52:06 I think the goal was to avoid leaking paint inform
trchen 2015/10/14 22:51:13 The real question is who will be using this data?
pdr. 2015/10/15 04:53:51 We're thinking in the same way wrt the subsequence
jbroman 2015/10/15 14:29:10 This class is in core/; the merge algorithm, which
trchen 2015/10/15 23:24:31 Done.
+ const TransformPaintPropertyNode* transformNodeForSelf() const { return m_transformNodeForSelf.get(); }
- bool hasPerspective() const { return m_perspective; }
- void setPerspective(PassRefPtr<TransformPaintPropertyNode> perspective) { m_perspective = perspective; }
- const TransformPaintPropertyNode* perspective() const { return m_perspective.get(); }
+ void setTransformNodeForDescendants(PassRefPtr<TransformPaintPropertyNode> node) { m_transformNodeForDescendants = node; }
+ const TransformPaintPropertyNode* transformNodeForDescendants() const { return m_transformNodeForDescendants.get(); }
private:
ObjectPaintProperties() { }
- RefPtr<TransformPaintPropertyNode> m_transform;
- RefPtr<TransformPaintPropertyNode> m_perspective;
+ RefPtr<TransformPaintPropertyNode> m_transformNodeForSelf;
+ RefPtr<TransformPaintPropertyNode> m_transformNodeForDescendants;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698