| Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| index 0df90d0a9753d32a449ab89e0a001078987f05ec..f2a20150d66f9d0977fe4ee46d85d7d716d4b295 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
|
| @@ -415,16 +415,23 @@ void PaintController::copyCachedSubsequence(size_t& cachedItemIndex) {
|
|
|
| DisplayItem::Id endSubsequenceId(cachedItem->client(),
|
| DisplayItem::kEndSubsequence);
|
| - Vector<PaintChunk>::const_iterator cachedChunk;
|
| + Vector<PaintChunk>::const_iterator nextCachedChunk =
|
| + m_currentPaintArtifact.paintChunks().end();
|
| if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
|
| - cachedChunk =
|
| - m_currentPaintArtifact.findChunkByDisplayItemIndex(cachedItemIndex);
|
| - DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end());
|
| - updateCurrentPaintChunkProperties(
|
| - cachedChunk->id ? &*cachedChunk->id : nullptr, cachedChunk->properties);
|
| - } else {
|
| - // Avoid uninitialized variable error on Windows.
|
| - cachedChunk = m_currentPaintArtifact.paintChunks().begin();
|
| + // Skip over any items that can't be paint chunk boundaries to find the
|
| + // first chunk following |cachedItemIndex|.
|
| + size_t nextChunkIndex = cachedItemIndex + 1;
|
| + for (; nextChunkIndex < m_currentPaintArtifact.getDisplayItemList().size();
|
| + nextChunkIndex++) {
|
| + const auto& item =
|
| + m_currentPaintArtifact.getDisplayItemList()[nextChunkIndex];
|
| + if (PaintChunker::canBeginOrEndChunk(item)) {
|
| + nextCachedChunk =
|
| + m_currentPaintArtifact.findChunkByDisplayItemIndex(nextChunkIndex);
|
| + DCHECK(nextCachedChunk != m_currentPaintArtifact.paintChunks().end());
|
| + break;
|
| + }
|
| + }
|
| }
|
|
|
| while (true) {
|
| @@ -436,17 +443,14 @@ void PaintController::copyCachedSubsequence(size_t& cachedItemIndex) {
|
| bool metEndSubsequence = cachedItem->getId() == endSubsequenceId;
|
| if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) {
|
| if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
|
| - cachedItemIndex == cachedChunk->endIndex) {
|
| - ++cachedChunk;
|
| - DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end());
|
| + nextCachedChunk != m_currentPaintArtifact.paintChunks().end() &&
|
| + cachedItemIndex == nextCachedChunk->beginIndex) {
|
| updateCurrentPaintChunkProperties(
|
| - cachedChunk->id ? &*cachedChunk->id : nullptr,
|
| - cachedChunk->properties);
|
| + nextCachedChunk->id ? &*nextCachedChunk->id : nullptr,
|
| + nextCachedChunk->properties);
|
| + nextCachedChunk++;
|
| }
|
| processNewItem(moveItemFromCurrentListToNewList(cachedItemIndex));
|
| - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
|
| - DCHECK((!m_newPaintChunks.lastChunk().id && !cachedChunk->id) ||
|
| - m_newPaintChunks.lastChunk().matches(*cachedChunk));
|
| }
|
|
|
| ++cachedItemIndex;
|
|
|