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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.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/ClipPaintPropertyNode.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h
index 7749aace88eaec366958ae0a6b16465392c13f75..ba3c3f3dc52dea45af43945a41efe6f38878fd54 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h
@@ -7,6 +7,7 @@
#include "platform/PlatformExport.h"
#include "platform/geometry/FloatRoundedRect.h"
+#include "platform/graphics/paint/FloatClipRect.h"
#include "platform/graphics/paint/TransformPaintPropertyNode.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -86,21 +87,60 @@ class PLATFORM_EXPORT ClipPaintPropertyNode
return m_directCompositingReasons != CompositingReasonNone;
}
+ // Clears all clip caches (see getClipCache()).
+ static void clearCache();
+
+ struct ClipAndTransform {
+ const ClipPaintPropertyNode* ancestorClip;
+ const TransformPaintPropertyNode* ancestorTransform;
+ bool operator==(const ClipAndTransform& other) const {
+ return ancestorClip == other.ancestorClip &&
+ ancestorTransform == other.ancestorTransform;
+ }
+ ClipAndTransform(const ClipPaintPropertyNode* ancestorClipArg,
+ const TransformPaintPropertyNode* ancestorTransformArg)
+ : ancestorClip(ancestorClipArg),
+ ancestorTransform(ancestorTransformArg) {}
+ };
+
private:
ClipPaintPropertyNode(
PassRefPtr<const ClipPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
const FloatRoundedRect& clipRect,
- CompositingReasons directCompositingReasons)
- : m_parent(parent),
- m_localTransformSpace(localTransformSpace),
- m_clipRect(clipRect),
- m_directCompositingReasons(directCompositingReasons) {}
+ CompositingReasons directCompositingReasons);
+
+ struct ClipCacheEntry {
+ const ClipAndTransform clipAndTransform;
+ const FloatClipRect clipRect;
+ ClipCacheEntry(const ClipAndTransform& clipAndTransformArg,
+ const FloatClipRect& clipRectArg)
+ : clipAndTransform(clipAndTransformArg), clipRect(clipRectArg) {}
+ };
+
+ Vector<ClipCacheEntry>* getClipCacheEntries();
+
+ // For access to getCachedClip() and setCachedClip.
+ friend class GeometryMapper;
+ friend class GeometryMapperTest;
+
+ // Returns the "clip visual rect" (See GeometryMapper.h) of |this|
+ // in the space of |ancestors|, if there is one cached. Otherwise returns
+ // null.
+ const FloatClipRect* getCachedClip(const ClipAndTransform& ancestors) const;
+ // Stores the "clip visual rect" of |this in the space of |ancestors|,
+ // into a local cache.
+
+ void setCachedClip(const ClipAndTransform&, const FloatClipRect&) const;
RefPtr<const ClipPaintPropertyNode> m_parent;
RefPtr<const TransformPaintPropertyNode> m_localTransformSpace;
FloatRoundedRect m_clipRect;
CompositingReasons m_directCompositingReasons;
+
+ std::unique_ptr<Vector<ClipCacheEntry>> m_clipCache;
+ unsigned m_cacheGeneration;
+ const FloatClipRect m_infiniteClip;
};
// Redeclared here to avoid ODR issues.

Powered by Google App Engine
This is Rietveld 408576698