Chromium Code Reviews| 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..051e55f35aecf3f31059602660aa126f3d2e8ded 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 DisplayItem::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<DisplayItem::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; |
|
pdr.
2016/07/14 22:22:06
For items following a foreign layer, will this lea
Xianzhu
2016/07/14 23:03:24
No. This will cause the chunk following the foreig
|
| + } else { |
| + behavior = DefaultBehavior; |
| + if (!item.skippedCache() && m_currentChunkId) |
|
pdr.
2016/07/14 22:22:06
Does this mean that skipping the cache causes one
Xianzhu
2016/07/14 23:03:24
No. Chunks will be created just as before, but the
|
| + 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; |
| } |