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

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

Issue 2116693002: PaintChunk::id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CommitOnTheWay
Patch Set: Address chrishtr's comments. Created 4 years, 5 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.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
index 485ec009c0a5657995fb08d4ac3ed465a753e754..fab3f180315d1a7073f82d8ea35758eaa63f4f4f 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp
@@ -16,19 +16,41 @@ PaintChunker::~PaintChunker()
{
}
-void PaintChunker::updateCurrentPaintChunkProperties(const PaintChunkProperties& properties)
+void PaintChunker::updateCurrentPaintChunkProperties(const PaintChunk::Id* chunkId, const PaintChunkProperties& properties)
{
ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ m_currentChunkId = WTF::nullopt;
+ if (chunkId)
+ m_currentChunkId.emplace(*chunkId);
m_currentProperties = properties;
}
-void PaintChunker::incrementDisplayItemIndex(ItemBehavior behavior)
+void PaintChunker::incrementDisplayItemIndex(const DisplayItem& item)
{
ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ ItemBehavior behavior;
+ Optional<PaintChunk::Id> newChunkId;
+ if (DisplayItem::isForeignLayerType(item.getType())) {
+ behavior = RequiresSeparateChunk;
+ // Use null chunkId if we are skipping cache, so that the chunk will not
+ // match any old chunk and will be treated as brand new.
+ if (!item.skippedCache())
+ newChunkId.emplace(item.getId());
+
+ // Clear m_currentChunkId so that any display items after the foreign layer
+ // without a new chunk id will be treated as having no id to avoid the chunk
+ // from using the same id as the chunk before the foreign layer chunk.
+ m_currentChunkId = WTF::nullopt;
+ } else {
+ behavior = DefaultBehavior;
+ if (!item.skippedCache() && m_currentChunkId)
+ newChunkId.emplace(*m_currentChunkId);
+ }
+
if (m_chunks.isEmpty()) {
- PaintChunk newChunk(0, 1, m_currentProperties);
+ PaintChunk newChunk(0, 1, newChunkId ? &*newChunkId : nullptr, m_currentProperties);
m_chunks.append(newChunk);
m_chunkBehavior.append(behavior);
return;
@@ -43,7 +65,7 @@ void PaintChunker::incrementDisplayItemIndex(ItemBehavior behavior)
return;
}
- PaintChunk newChunk(lastChunk.endIndex, lastChunk.endIndex + 1, m_currentProperties);
+ PaintChunk newChunk(lastChunk.endIndex, lastChunk.endIndex + 1, newChunkId ? &*newChunkId : nullptr, m_currentProperties);
m_chunks.append(newChunk);
m_chunkBehavior.append(behavior);
}
@@ -66,6 +88,7 @@ void PaintChunker::clear()
{
m_chunks.clear();
m_chunkBehavior.clear();
+ m_currentChunkId = WTF::nullopt;
m_currentProperties = PaintChunkProperties();
}
@@ -74,6 +97,7 @@ Vector<PaintChunk> PaintChunker::releasePaintChunks()
Vector<PaintChunk> chunks;
chunks.swap(m_chunks);
m_chunkBehavior.clear();
+ m_currentChunkId = WTF::nullopt;
m_currentProperties = PaintChunkProperties();
return chunks;
}

Powered by Google App Engine
This is Rietveld 408576698