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

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

Issue 2621193006: Reduce PropertyTreeState construction and copies (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ff54858193a1b1f198bf1995f5e47eea2746e476..2ccf33bcf22d1e122551ed12defbf0806f4b1efb 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -134,7 +134,23 @@ class CORE_EXPORT ObjectPaintProperties {
// localBorderBoxProperties but includes properties (e.g., overflow clip,
// scroll translation) that apply to contents. This is suitable for paint
// invalidation.
- PropertyTreeState contentsProperties() const;
+ const PropertyTreeState* contentsProperties() const {
+ if (!m_contentsProperties) {
+ if (!m_localBorderBoxProperties)
+ return nullptr;
+ updateContentsProperties();
+ } else {
+#if DCHECK_IS_ON()
+ // Check if the cached m_contentsProperties is valid.
+ DCHECK(m_localBorderBoxProperties);
+ std::unique_ptr<PropertyTreeState> oldProperties =
+ std::move(m_contentsProperties);
+ updateContentsProperties();
+ DCHECK(*m_contentsProperties == *oldProperties);
+#endif
+ }
+ return m_contentsProperties.get();
+ };
void updateLocalBorderBoxProperties(
const TransformPaintPropertyNode* transform,
@@ -150,8 +166,12 @@ class CORE_EXPORT ObjectPaintProperties {
m_localBorderBoxProperties = WTF::wrapUnique(new PropertyTreeState(
PropertyTreeState(transform, clip, effect, scroll)));
}
+ m_contentsProperties = nullptr;
+ }
+ void clearLocalBorderBoxProperties() {
+ m_localBorderBoxProperties = nullptr;
+ m_contentsProperties = nullptr;
}
- void clearLocalBorderBoxProperties() { m_localBorderBoxProperties = nullptr; }
// The following clear* functions return true if the property tree structure
// changes (an existing node was deleted), and false otherwise. See the
@@ -297,6 +317,8 @@ class CORE_EXPORT ObjectPaintProperties {
return true;
}
+ void updateContentsProperties() const;
+
RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
RefPtr<TransformPaintPropertyNode> m_transform;
RefPtr<EffectPaintPropertyNode> m_effect;
@@ -312,6 +334,7 @@ class CORE_EXPORT ObjectPaintProperties {
RefPtr<ScrollPaintPropertyNode> m_scroll;
std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties;
+ mutable std::unique_ptr<PropertyTreeState> m_contentsProperties;
};
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698