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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h

Issue 2729243002: Improve performance of GeometryMapper cache. (Closed)
Patch Set: none Created 3 years, 9 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/platform/graphics/paint/TransformPaintPropertyNode.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h
index 76844fb8d94561ee2542d86cc923ad7a799f78c9..50b68837d11559eebdd6cc63fbff019286248fb2 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h
@@ -188,6 +188,9 @@ class PLATFORM_EXPORT TransformPaintPropertyNode
String toString() const;
+ // Clears all transform caches (see getTransformCache()).
+ static void clearCache();
+
private:
TransformPaintPropertyNode(
PassRefPtr<const TransformPaintPropertyNode> parent,
@@ -207,6 +210,31 @@ class PLATFORM_EXPORT TransformPaintPropertyNode
m_compositorElementId(compositorElementId),
m_scroll(scroll) {}
+ struct TransformCacheEntry {
+ const TransformPaintPropertyNode* ancestorNode;
+ TransformationMatrix toAncestor;
+ TransformCacheEntry(const TransformPaintPropertyNode* ancestorNodeArg,
+ const TransformationMatrix& toAncestorArg)
+ : ancestorNode(ancestorNodeArg), toAncestor(toAncestorArg) {}
+ };
+
+ // For access to getCachedTransform() and setCachedTransform.
+ friend class GeometryMapper;
+ friend class GeometryMapperTest;
+
+ Vector<TransformCacheEntry>* getTransformCacheEntries();
+
+ // Returns the "transformed rect" (see GeometryMapper.h) of |this| in the
+ // space of |ancestorTransform|, if there is one cached. Otherwise returns
+ // null.
+ const TransformationMatrix* getCachedTransform(
+ const TransformPaintPropertyNode* ancestorTransform) const;
+
+ // Stores the "transformed rect" of |this| in the space of |ancestors|,
+ // into a local cache.
+ void setCachedTransform(const TransformPaintPropertyNode* ancestorTransform,
+ const TransformationMatrix& toAncestor) const;
+
RefPtr<const TransformPaintPropertyNode> m_parent;
TransformationMatrix m_matrix;
FloatPoint3D m_origin;
@@ -215,6 +243,9 @@ class PLATFORM_EXPORT TransformPaintPropertyNode
CompositingReasons m_directCompositingReasons;
CompositorElementId m_compositorElementId;
RefPtr<ScrollPaintPropertyNode> m_scroll;
+
+ std::unique_ptr<Vector<TransformCacheEntry>> m_transformCache;
+ unsigned m_cacheGeneration;
};
// Redeclared here to avoid ODR issues.

Powered by Google App Engine
This is Rietveld 408576698