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

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

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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintChunkerTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698