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

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

Issue 2698673007: Only create PaintChunks at drawing and foreignLayer boundaries (Closed)
Patch Set: Great expectations Created 3 years, 10 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/PaintChunker.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.h b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.h
index ff6da1fc0b7ddf852ab94f4f00df3a654499ea83..23d3fb9d7a80e6a5997c89293556b94e1272b73a 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.h
@@ -15,9 +15,13 @@
namespace blink {
-// Accepts information about changes to |PaintChunkProperties| as drawings are
-// accumulated, and produces a series of paint chunks: contiguous ranges of the
-// display list with identical |PaintChunkProperties|.
+// Accepts information about changes to |PaintChunkProperties| as drawings and
+// foreign layers [1] are accumulated, and produces a series of paint chunks:
+// contiguous ranges of the display list with identical |PaintChunkProperties|.
+//
+// [1] Only drawings and foreign layers are used for compositing (i.e., other
+// display item types are ignored by PaintArtifactCompositor), so other types
+// do not create paint chunks as an optimization (see: canBeginOrEndChunk).
class PLATFORM_EXPORT PaintChunker final {
DISALLOW_NEW();
WTF_MAKE_NONCOPYABLE(PaintChunker);
@@ -27,7 +31,9 @@ class PLATFORM_EXPORT PaintChunker final {
~PaintChunker();
bool isInInitialState() const {
- return m_chunks.isEmpty() && m_currentProperties == PaintChunkProperties();
+ return m_chunks.isEmpty() &&
+ m_currentProperties == PaintChunkProperties() &&
+ m_skippedItemsSinceLastChunk == 0;
}
const PaintChunkProperties& currentPaintChunkProperties() const {
@@ -41,6 +47,13 @@ class PLATFORM_EXPORT PaintChunker final {
// Returns true if the last chunk is removed.
bool decrementDisplayItemIndex();
+ // Paint chunks are only created/ended at drawing and foreign layer boundaries
+ // with all other types being skipped (see: m_skippedItemsSinceLastChunk).
+ static bool canBeginOrEndChunk(const DisplayItem& item) {
+ return DisplayItem::isDrawingType(item.getType()) ||
+ DisplayItem::isForeignLayerType(item.getType());
+ }
+
PaintChunk& paintChunkAt(size_t i) { return m_chunks[i]; }
size_t lastChunkIndex() const {
return m_chunks.isEmpty() ? kNotFound : m_chunks.size() - 1;
@@ -72,6 +85,7 @@ class PLATFORM_EXPORT PaintChunker final {
Vector<ItemBehavior> m_chunkBehavior;
Optional<PaintChunk::Id> m_currentChunkId;
PaintChunkProperties m_currentProperties;
+ size_t m_skippedItemsSinceLastChunk;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698