| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/graphics/GraphicsLayer.h" | 7 #include "platform/graphics/GraphicsLayer.h" |
| 8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 9 #include "platform/instrumentation/tracing/TraceEvent.h" | 9 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const DisplayItemClient& client, | 37 const DisplayItemClient& client, |
| 38 DisplayItem::Type type) { | 38 DisplayItem::Type type) { |
| 39 DCHECK(DisplayItem::isDrawingType(type)); | 39 DCHECK(DisplayItem::isDrawingType(type)); |
| 40 | 40 |
| 41 if (displayItemConstructionIsDisabled()) | 41 if (displayItemConstructionIsDisabled()) |
| 42 return false; | 42 return false; |
| 43 | 43 |
| 44 if (!clientCacheIsValid(client)) | 44 if (!clientCacheIsValid(client)) |
| 45 return false; | 45 return false; |
| 46 | 46 |
| 47 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && | 47 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 48 isCheckingUnderInvalidation()) { | 48 if (isCheckingUnderInvalidation()) { |
| 49 // We are checking under-invalidation of a subsequence enclosing this | 49 // We are checking under-invalidation of a subsequence enclosing this |
| 50 // display item. Let the client continue to actually paint the display item. | 50 // display item. Let the client continue to actually paint the display |
| 51 return false; | 51 // item. |
| 52 return false; |
| 53 } |
| 54 if (m_isCheckingSubsequenceUnderInvalidation) { |
| 55 showSequenceUnderInvalidationError( |
| 56 "under-invalidation: new subsequence wrong length", client, |
| 57 m_newDisplayItemList.size(), m_newDisplayItemList.size()); |
| 58 DCHECK(false); |
| 59 } |
| 52 } | 60 } |
| 53 | 61 |
| 54 size_t cachedItem = findCachedItem(DisplayItem::Id(client, type)); | 62 size_t cachedItem = findCachedItem(DisplayItem::Id(client, type)); |
| 55 if (cachedItem == kNotFound) { | 63 if (cachedItem == kNotFound) { |
| 56 NOTREACHED(); | 64 NOTREACHED(); |
| 57 return false; | 65 return false; |
| 58 } | 66 } |
| 59 | 67 |
| 60 ++m_numCachedNewItems; | 68 ++m_numCachedNewItems; |
| 61 ensureNewDisplayItemListInitialCapacity(); | 69 ensureNewDisplayItemListInitialCapacity(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 92 | 100 |
| 93 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && | 101 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() && |
| 94 isCheckingUnderInvalidation()) { | 102 isCheckingUnderInvalidation()) { |
| 95 // We are checking under-invalidation of an ancestor subsequence enclosing | 103 // We are checking under-invalidation of an ancestor subsequence enclosing |
| 96 // this one. The ancestor subsequence is supposed to have already "copied", | 104 // this one. The ancestor subsequence is supposed to have already "copied", |
| 97 // so we should let the client continue to actually paint the descendant | 105 // so we should let the client continue to actually paint the descendant |
| 98 // subsequences without "copying". | 106 // subsequences without "copying". |
| 99 return false; | 107 return false; |
| 100 } | 108 } |
| 101 | 109 |
| 102 size_t cachedItem = | 110 SubsequenceMarkers* markers = getSubsequenceMarkers(client); |
| 103 findCachedItem(DisplayItem::Id(client, DisplayItem::kSubsequence)); | 111 if (!markers) { |
| 104 if (cachedItem == kNotFound) { | |
| 105 NOTREACHED(); | |
| 106 return false; | 112 return false; |
| 107 } | 113 } |
| 108 | 114 |
| 109 // |cachedItem| will point to the first item after the subsequence or end of | 115 // |cachedItem| will point to the first item after the subsequence or end of |
| 110 // the current list. | 116 // the current list. |
| 111 ensureNewDisplayItemListInitialCapacity(); | 117 ensureNewDisplayItemListInitialCapacity(); |
| 112 copyCachedSubsequence(cachedItem); | |
| 113 | 118 |
| 114 m_nextItemToMatch = cachedItem; | 119 size_t sizeBeforeCopy = m_newDisplayItemList.size(); |
| 115 // Items before |cachedItem| have been copied so we don't need to index them. | 120 copyCachedSubsequence(markers->start, markers->end); |
| 116 if (cachedItem > m_nextItemToIndex) | 121 |
| 117 m_nextItemToIndex = cachedItem; | 122 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 123 addCachedSubsequence(client, sizeBeforeCopy, |
| 124 m_newDisplayItemList.size() - 1); |
| 125 } |
| 126 |
| 127 m_nextItemToMatch = markers->end + 1; |
| 128 // Items before |m_nextItemToMatch| have been copied so we don't need to index |
| 129 // them. |
| 130 if (m_nextItemToMatch > m_nextItemToIndex) |
| 131 m_nextItemToIndex = m_nextItemToMatch; |
| 118 | 132 |
| 119 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 133 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 120 // Return false to let the painter actually paint. We will check if the new | 134 // Return false to let the painter actually paint. We will check if the new |
| 121 // painting is the same as the cached one. | 135 // painting is the same as the cached one. |
| 122 return false; | 136 return false; |
| 123 } | 137 } |
| 124 | 138 |
| 125 return true; | 139 return true; |
| 126 } | 140 } |
| 127 | 141 |
| 142 PaintController::SubsequenceMarkers* PaintController::getSubsequenceMarkers( |
| 143 const DisplayItemClient& client) { |
| 144 auto result = m_currentCachedSubsequences.find(&client); |
| 145 if (result == m_currentCachedSubsequences.end()) |
| 146 return nullptr; |
| 147 return &result->value; |
| 148 } |
| 149 |
| 150 void PaintController::addCachedSubsequence(const DisplayItemClient& client, |
| 151 unsigned start, |
| 152 unsigned end) { |
| 153 DCHECK(start <= end); |
| 154 DCHECK(end < m_newDisplayItemList.size()); |
| 155 if (isCheckingUnderInvalidation()) { |
| 156 if (start - end < |
| 157 m_underInvalidationCheckingEnd - m_underInvalidationCheckingBegin) { |
| 158 showSequenceUnderInvalidationError( |
| 159 "under-invalidation: new subsequence wrong length", client, start, |
| 160 end); |
| 161 DCHECK(false); |
| 162 } |
| 163 } |
| 164 m_isCheckingSubsequenceUnderInvalidation = false; |
| 165 |
| 166 DCHECK(m_newCachedSubsequences.find(&client) == |
| 167 m_newCachedSubsequences.end()); |
| 168 |
| 169 m_newCachedSubsequences.insert(&client, SubsequenceMarkers(start, end)); |
| 170 } |
| 171 |
| 128 bool PaintController::lastDisplayItemIsNoopBegin() const { | 172 bool PaintController::lastDisplayItemIsNoopBegin() const { |
| 129 if (m_newDisplayItemList.isEmpty()) | 173 if (m_newDisplayItemList.isEmpty()) |
| 130 return false; | 174 return false; |
| 131 | 175 |
| 132 const auto& lastDisplayItem = m_newDisplayItemList.last(); | 176 const auto& lastDisplayItem = m_newDisplayItemList.last(); |
| 133 return lastDisplayItem.isBegin() && !lastDisplayItem.drawsContent(); | 177 return lastDisplayItem.isBegin() && !lastDisplayItem.drawsContent(); |
| 134 } | 178 } |
| 135 | 179 |
| 136 void PaintController::removeLastDisplayItem() { | 180 void PaintController::removeLastDisplayItem() { |
| 137 if (m_newDisplayItemList.isEmpty()) | 181 if (m_newDisplayItemList.isEmpty()) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 216 |
| 173 void PaintController::processNewItem(DisplayItem& displayItem) { | 217 void PaintController::processNewItem(DisplayItem& displayItem) { |
| 174 DCHECK(!m_constructionDisabled); | 218 DCHECK(!m_constructionDisabled); |
| 175 | 219 |
| 176 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 220 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 177 if (!isSkippingCache()) { | 221 if (!isSkippingCache()) { |
| 178 if (displayItem.isCacheable()) { | 222 if (displayItem.isCacheable()) { |
| 179 // Mark the client shouldKeepAlive under this PaintController. | 223 // Mark the client shouldKeepAlive under this PaintController. |
| 180 // The status will end after the new display items are committed. | 224 // The status will end after the new display items are committed. |
| 181 displayItem.client().beginShouldKeepAlive(this); | 225 displayItem.client().beginShouldKeepAlive(this); |
| 182 | |
| 183 if (!m_currentSubsequenceClients.isEmpty()) { | |
| 184 // Mark the client shouldKeepAlive under the current subsequence. | |
| 185 // The status will end when the subsequence owner is invalidated or | |
| 186 // deleted. | |
| 187 displayItem.client().beginShouldKeepAlive( | |
| 188 m_currentSubsequenceClients.back()); | |
| 189 } | |
| 190 } | |
| 191 | |
| 192 if (displayItem.getType() == DisplayItem::kSubsequence) { | |
| 193 m_currentSubsequenceClients.push_back(&displayItem.client()); | |
| 194 } else if (displayItem.getType() == DisplayItem::kEndSubsequence) { | |
| 195 CHECK(m_currentSubsequenceClients.back() == &displayItem.client()); | |
| 196 m_currentSubsequenceClients.pop_back(); | |
| 197 } | 226 } |
| 198 } | 227 } |
| 199 #endif | 228 #endif |
| 200 | 229 |
| 201 if (isSkippingCache()) | 230 if (isSkippingCache()) |
| 202 displayItem.setSkippedCache(); | 231 displayItem.setSkippedCache(); |
| 203 | 232 |
| 204 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 233 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 205 size_t lastChunkIndex = m_newPaintChunks.lastChunkIndex(); | 234 size_t lastChunkIndex = m_newPaintChunks.lastChunkIndex(); |
| 206 if (m_newPaintChunks.incrementDisplayItemIndex(displayItem)) { | 235 if (m_newPaintChunks.incrementDisplayItemIndex(displayItem)) { |
| 207 DCHECK(lastChunkIndex != m_newPaintChunks.lastChunkIndex()); | 236 DCHECK(lastChunkIndex != m_newPaintChunks.lastChunkIndex()); |
| 208 if (lastChunkIndex != kNotFound) | 237 if (lastChunkIndex != kNotFound) |
| 209 generateChunkRasterInvalidationRects( | 238 generateChunkRasterInvalidationRects( |
| 210 m_newPaintChunks.paintChunkAt(lastChunkIndex)); | 239 m_newPaintChunks.paintChunkAt(lastChunkIndex)); |
| 211 } | 240 } |
| 212 } | 241 } |
| 213 | 242 |
| 214 #if DCHECK_IS_ON() | 243 #if DCHECK_IS_ON() |
| 215 // Verify noop begin/end pairs have been removed. | 244 // Verify noop begin/end pairs have been removed. |
| 216 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { | 245 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { |
| 217 const auto& beginDisplayItem = | 246 const auto& beginDisplayItem = |
| 218 m_newDisplayItemList[m_newDisplayItemList.size() - 2]; | 247 m_newDisplayItemList[m_newDisplayItemList.size() - 2]; |
| 219 if (beginDisplayItem.isBegin() && | 248 if (beginDisplayItem.isBegin() && |
| 220 beginDisplayItem.getType() != DisplayItem::kSubsequence && | |
| 221 !beginDisplayItem.drawsContent()) | 249 !beginDisplayItem.drawsContent()) |
| 222 DCHECK(!displayItem.isEndAndPairedWith(beginDisplayItem.getType())); | 250 DCHECK(!displayItem.isEndAndPairedWith(beginDisplayItem.getType())); |
| 223 } | 251 } |
| 224 | 252 |
| 225 size_t index = findMatchingItemFromIndex(displayItem.getId(), | 253 size_t index = findMatchingItemFromIndex(displayItem.getId(), |
| 226 m_newDisplayItemIndicesByClient, | 254 m_newDisplayItemIndicesByClient, |
| 227 m_newDisplayItemList); | 255 m_newDisplayItemList); |
| 228 if (index != kNotFound) { | 256 if (index != kNotFound) { |
| 229 #ifndef NDEBUG | 257 #ifndef NDEBUG |
| 230 showDebugData(); | 258 showDebugData(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) | 414 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
| 387 CHECK(false) << "Can't find cached display item"; | 415 CHECK(false) << "Can't find cached display item"; |
| 388 | 416 |
| 389 // We did not find the cached display item. This should be impossible, but may | 417 // We did not find the cached display item. This should be impossible, but may |
| 390 // occur if there is a bug in the system, such as under-invalidation, | 418 // occur if there is a bug in the system, such as under-invalidation, |
| 391 // incorrect cache checking or duplicate display ids. In this case, the caller | 419 // incorrect cache checking or duplicate display ids. In this case, the caller |
| 392 // should fall back to repaint the display item. | 420 // should fall back to repaint the display item. |
| 393 return kNotFound; | 421 return kNotFound; |
| 394 } | 422 } |
| 395 | 423 |
| 396 // Copies a cached subsequence from current list to the new list. On return, | 424 // Copies a cached subsequence from current list to the new list. |
| 397 // |cachedItemIndex| points to the item after the EndSubsequence item of the | 425 // When paintUnderInvaldiationCheckingEnabled() we'll not actually |
| 398 // subsequence. When paintUnderInvaldiationCheckingEnabled() we'll not actually | |
| 399 // copy the subsequence, but mark the begin and end of the subsequence for | 426 // copy the subsequence, but mark the begin and end of the subsequence for |
| 400 // under-invalidation checking. | 427 // under-invalidation checking. |
| 401 void PaintController::copyCachedSubsequence(size_t& cachedItemIndex) { | 428 void PaintController::copyCachedSubsequence(size_t beginIndex, |
| 429 size_t endIndex) { |
| 402 AutoReset<size_t> subsequenceBeginIndex( | 430 AutoReset<size_t> subsequenceBeginIndex( |
| 403 &m_currentCachedSubsequenceBeginIndexInNewList, | 431 &m_currentCachedSubsequenceBeginIndexInNewList, |
| 404 m_newDisplayItemList.size()); | 432 m_newDisplayItemList.size()); |
| 405 DisplayItem* cachedItem = | 433 DisplayItem* cachedItem = |
| 406 &m_currentPaintArtifact.getDisplayItemList()[cachedItemIndex]; | 434 &m_currentPaintArtifact.getDisplayItemList()[beginIndex]; |
| 407 DCHECK(cachedItem->getType() == DisplayItem::kSubsequence); | |
| 408 | 435 |
| 409 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 436 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 410 DCHECK(!isCheckingUnderInvalidation()); | 437 DCHECK(!isCheckingUnderInvalidation()); |
| 411 m_underInvalidationCheckingBegin = cachedItemIndex; | 438 m_underInvalidationCheckingBegin = beginIndex; |
| 412 m_underInvalidationMessagePrefix = | 439 m_underInvalidationMessagePrefix = |
| 413 "(In cached subsequence of " + cachedItem->client().debugName() + ")"; | 440 "(In cached subsequence of " + cachedItem->client().debugName() + ")"; |
| 414 } | 441 } |
| 415 | 442 |
| 416 DisplayItem::Id endSubsequenceId(cachedItem->client(), | |
| 417 DisplayItem::kEndSubsequence); | |
| 418 Vector<PaintChunk>::const_iterator cachedChunk; | 443 Vector<PaintChunk>::const_iterator cachedChunk; |
| 419 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 444 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 420 cachedChunk = | 445 cachedChunk = |
| 421 m_currentPaintArtifact.findChunkByDisplayItemIndex(cachedItemIndex); | 446 m_currentPaintArtifact.findChunkByDisplayItemIndex(beginIndex); |
| 422 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); | 447 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); |
| 423 updateCurrentPaintChunkProperties( | 448 updateCurrentPaintChunkProperties( |
| 424 cachedChunk->id ? &*cachedChunk->id : nullptr, cachedChunk->properties); | 449 cachedChunk->id ? &*cachedChunk->id : nullptr, cachedChunk->properties); |
| 425 } else { | 450 } else { |
| 426 // Avoid uninitialized variable error on Windows. | 451 // Avoid uninitialized variable error on Windows. |
| 427 cachedChunk = m_currentPaintArtifact.paintChunks().begin(); | 452 cachedChunk = m_currentPaintArtifact.paintChunks().begin(); |
| 428 } | 453 } |
| 429 | 454 |
| 430 while (true) { | 455 for (size_t currentIndex = beginIndex; currentIndex <= endIndex; |
| 456 ++currentIndex) { |
| 457 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[currentIndex]; |
| 431 DCHECK(cachedItem->hasValidClient()); | 458 DCHECK(cachedItem->hasValidClient()); |
| 432 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 459 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 433 CHECK(cachedItem->client().isAlive()); | 460 CHECK(cachedItem->client().isAlive()); |
| 434 #endif | 461 #endif |
| 435 ++m_numCachedNewItems; | 462 ++m_numCachedNewItems; |
| 436 bool metEndSubsequence = cachedItem->getId() == endSubsequenceId; | |
| 437 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 463 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 438 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 464 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 439 cachedItemIndex == cachedChunk->endIndex) { | 465 currentIndex == cachedChunk->endIndex) { |
| 440 ++cachedChunk; | 466 ++cachedChunk; |
| 441 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); | 467 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); |
| 442 updateCurrentPaintChunkProperties( | 468 updateCurrentPaintChunkProperties( |
| 443 cachedChunk->id ? &*cachedChunk->id : nullptr, | 469 cachedChunk->id ? &*cachedChunk->id : nullptr, |
| 444 cachedChunk->properties); | 470 cachedChunk->properties); |
| 445 } | 471 } |
| 446 processNewItem(moveItemFromCurrentListToNewList(cachedItemIndex)); | 472 processNewItem(moveItemFromCurrentListToNewList(currentIndex)); |
| 447 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 473 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 448 DCHECK((!m_newPaintChunks.lastChunk().id && !cachedChunk->id) || | 474 DCHECK((!m_newPaintChunks.lastChunk().id && !cachedChunk->id) || |
| 449 m_newPaintChunks.lastChunk().matches(*cachedChunk)); | 475 m_newPaintChunks.lastChunk().matches(*cachedChunk)); |
| 450 } | 476 } |
| 451 | |
| 452 ++cachedItemIndex; | |
| 453 if (metEndSubsequence) | |
| 454 break; | |
| 455 | |
| 456 // We should always be able to find the EndSubsequence display item. | |
| 457 DCHECK(cachedItemIndex < | |
| 458 m_currentPaintArtifact.getDisplayItemList().size()); | |
| 459 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[cachedItemIndex]; | |
| 460 } | 477 } |
| 461 | 478 |
| 462 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 479 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 463 m_underInvalidationCheckingEnd = cachedItemIndex; | 480 m_underInvalidationCheckingEnd = endIndex + 1; |
| 481 m_isCheckingSubsequenceUnderInvalidation = true; |
| 464 DCHECK(isCheckingUnderInvalidation()); | 482 DCHECK(isCheckingUnderInvalidation()); |
| 465 } | 483 } |
| 466 } | 484 } |
| 467 | 485 |
| 468 DISABLE_CFI_PERF | 486 DISABLE_CFI_PERF |
| 469 static IntRect visualRectForDisplayItem( | 487 static IntRect visualRectForDisplayItem( |
| 470 const DisplayItem& displayItem, | 488 const DisplayItem& displayItem, |
| 471 const LayoutSize& offsetFromLayoutObject) { | 489 const LayoutSize& offsetFromLayoutObject) { |
| 472 LayoutRect visualRect = displayItem.client().visualRect(); | 490 LayoutRect visualRect = displayItem.client().visualRect(); |
| 473 visualRect.move(-offsetFromLayoutObject); | 491 visualRect.move(-offsetFromLayoutObject); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 500 #endif | 518 #endif |
| 501 | 519 |
| 502 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 520 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 503 !m_newDisplayItemList.isEmpty()) | 521 !m_newDisplayItemList.isEmpty()) |
| 504 generateChunkRasterInvalidationRects(m_newPaintChunks.lastChunk()); | 522 generateChunkRasterInvalidationRects(m_newPaintChunks.lastChunk()); |
| 505 | 523 |
| 506 SkPictureGpuAnalyzer gpuAnalyzer; | 524 SkPictureGpuAnalyzer gpuAnalyzer; |
| 507 | 525 |
| 508 m_currentCacheGeneration = | 526 m_currentCacheGeneration = |
| 509 DisplayItemClient::CacheGenerationOrInvalidationReason::next(); | 527 DisplayItemClient::CacheGenerationOrInvalidationReason::next(); |
| 528 |
| 529 m_newCachedSubsequences.swap(m_currentCachedSubsequences); |
| 530 m_newCachedSubsequences.clear(); |
| 531 for (auto& item : m_currentCachedSubsequences) |
| 532 item.key->setDisplayItemsCached(m_currentCacheGeneration); |
| 533 |
| 510 Vector<const DisplayItemClient*> skippedCacheClients; | 534 Vector<const DisplayItemClient*> skippedCacheClients; |
| 511 for (const auto& item : m_newDisplayItemList) { | 535 for (const auto& item : m_newDisplayItemList) { |
| 512 // No reason to continue the analysis once we have a veto. | 536 // No reason to continue the analysis once we have a veto. |
| 513 if (gpuAnalyzer.suitableForGpuRasterization()) | 537 if (gpuAnalyzer.suitableForGpuRasterization()) |
| 514 item.analyzeForGpuRasterization(gpuAnalyzer); | 538 item.analyzeForGpuRasterization(gpuAnalyzer); |
| 515 | 539 |
| 516 // TODO(wkorman): Only compute and append visual rect for drawings. | 540 // TODO(wkorman): Only compute and append visual rect for drawings. |
| 517 m_newDisplayItemList.appendVisualRect( | 541 m_newDisplayItemList.appendVisualRect( |
| 518 visualRectForDisplayItem(item, offsetFromLayoutObject)); | 542 visualRectForDisplayItem(item, offsetFromLayoutObject)); |
| 519 | 543 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 for (const auto& chunk : m_currentPaintArtifact.paintChunks()) { | 583 for (const auto& chunk : m_currentPaintArtifact.paintChunks()) { |
| 560 if (chunk.id && chunk.id->client.isJustCreated()) | 584 if (chunk.id && chunk.id->client.isJustCreated()) |
| 561 chunk.id->client.clearIsJustCreated(); | 585 chunk.id->client.clearIsJustCreated(); |
| 562 } | 586 } |
| 563 } | 587 } |
| 564 | 588 |
| 565 // We'll allocate the initial buffer when we start the next paint. | 589 // We'll allocate the initial buffer when we start the next paint. |
| 566 m_newDisplayItemList = DisplayItemList(0); | 590 m_newDisplayItemList = DisplayItemList(0); |
| 567 | 591 |
| 568 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 592 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 569 CHECK(m_currentSubsequenceClients.isEmpty()); | |
| 570 DisplayItemClient::endShouldKeepAliveAllClients(this); | 593 DisplayItemClient::endShouldKeepAliveAllClients(this); |
| 571 #endif | 594 #endif |
| 572 | 595 |
| 573 #ifndef NDEBUG | 596 #ifndef NDEBUG |
| 574 m_numSequentialMatches = 0; | 597 m_numSequentialMatches = 0; |
| 575 m_numOutOfOrderMatches = 0; | 598 m_numOutOfOrderMatches = 0; |
| 576 m_numIndexedItems = 0; | 599 m_numIndexedItems = 0; |
| 577 #endif | 600 #endif |
| 578 } | 601 } |
| 579 | 602 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 } | 801 } |
| 779 LOG(INFO) << "new record:\n" | 802 LOG(INFO) << "new record:\n" |
| 780 << (newRecord ? recordAsDebugString(newRecord) : "None"); | 803 << (newRecord ? recordAsDebugString(newRecord) : "None"); |
| 781 LOG(INFO) << "old record:\n" | 804 LOG(INFO) << "old record:\n" |
| 782 << (oldRecord ? recordAsDebugString(oldRecord) : "None"); | 805 << (oldRecord ? recordAsDebugString(oldRecord) : "None"); |
| 783 | 806 |
| 784 showDebugData(); | 807 showDebugData(); |
| 785 #endif // NDEBUG | 808 #endif // NDEBUG |
| 786 } | 809 } |
| 787 | 810 |
| 811 void PaintController::showSequenceUnderInvalidationError( |
| 812 const char* reason, |
| 813 const DisplayItemClient& client, |
| 814 int start, |
| 815 int end) { |
| 816 LOG(ERROR) << m_underInvalidationMessagePrefix << " " << reason; |
| 817 LOG(ERROR) << "Subsequence client: " << client.debugName(); |
| 818 #ifndef NDEBUG |
| 819 showDebugData(); |
| 820 #else |
| 821 LOG(ERROR) << "Run debug build to get more details."; |
| 822 #endif |
| 823 LOG(ERROR) << "See http://crbug.com/619103."; |
| 824 } |
| 825 |
| 788 void PaintController::checkUnderInvalidation() { | 826 void PaintController::checkUnderInvalidation() { |
| 789 DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); | 827 DCHECK(RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()); |
| 790 | 828 |
| 791 if (!isCheckingUnderInvalidation()) | 829 if (!isCheckingUnderInvalidation()) |
| 792 return; | 830 return; |
| 793 | 831 |
| 794 const DisplayItem& newItem = m_newDisplayItemList.last(); | 832 const DisplayItem& newItem = m_newDisplayItemList.last(); |
| 795 size_t oldItemIndex = m_underInvalidationCheckingBegin + | 833 size_t oldItemIndex = m_underInvalidationCheckingBegin + |
| 796 m_skippedProbableUnderInvalidationCount; | 834 m_skippedProbableUnderInvalidationCount; |
| 797 DisplayItem* oldItem = | 835 DisplayItem* oldItem = |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 showPaintRecords | 901 showPaintRecords |
| 864 ? (DisplayItemList::JsonOptions::ShowPaintRecords | | 902 ? (DisplayItemList::JsonOptions::ShowPaintRecords | |
| 865 DisplayItemList::JsonOptions::ShowClientDebugName) | 903 DisplayItemList::JsonOptions::ShowClientDebugName) |
| 866 : DisplayItemList::JsonOptions::ShowClientDebugName) | 904 : DisplayItemList::JsonOptions::ShowClientDebugName) |
| 867 ->toPrettyJSONString() | 905 ->toPrettyJSONString() |
| 868 .utf8() | 906 .utf8() |
| 869 .data()); | 907 .data()); |
| 870 } | 908 } |
| 871 | 909 |
| 872 } // namespace blink | 910 } // namespace blink |
| OLD | NEW |