| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 408 |
| 409 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 409 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 410 DCHECK(!isCheckingUnderInvalidation()); | 410 DCHECK(!isCheckingUnderInvalidation()); |
| 411 m_underInvalidationCheckingBegin = cachedItemIndex; | 411 m_underInvalidationCheckingBegin = cachedItemIndex; |
| 412 m_underInvalidationMessagePrefix = | 412 m_underInvalidationMessagePrefix = |
| 413 "(In cached subsequence of " + cachedItem->client().debugName() + ")"; | 413 "(In cached subsequence of " + cachedItem->client().debugName() + ")"; |
| 414 } | 414 } |
| 415 | 415 |
| 416 DisplayItem::Id endSubsequenceId(cachedItem->client(), | 416 DisplayItem::Id endSubsequenceId(cachedItem->client(), |
| 417 DisplayItem::kEndSubsequence); | 417 DisplayItem::kEndSubsequence); |
| 418 Vector<PaintChunk>::const_iterator cachedChunk; | 418 Vector<PaintChunk>::const_iterator nextCachedChunk = |
| 419 m_currentPaintArtifact.paintChunks().end(); |
| 419 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 420 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 420 cachedChunk = | 421 // Skip over any items that can't be paint chunk boundaries to find the |
| 421 m_currentPaintArtifact.findChunkByDisplayItemIndex(cachedItemIndex); | 422 // first chunk following |cachedItemIndex|. |
| 422 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); | 423 size_t nextChunkIndex = cachedItemIndex + 1; |
| 423 updateCurrentPaintChunkProperties( | 424 for (; nextChunkIndex < m_currentPaintArtifact.getDisplayItemList().size(); |
| 424 cachedChunk->id ? &*cachedChunk->id : nullptr, cachedChunk->properties); | 425 nextChunkIndex++) { |
| 425 } else { | 426 const auto& item = |
| 426 // Avoid uninitialized variable error on Windows. | 427 m_currentPaintArtifact.getDisplayItemList()[nextChunkIndex]; |
| 427 cachedChunk = m_currentPaintArtifact.paintChunks().begin(); | 428 if (PaintChunker::canBeginOrEndChunk(item)) { |
| 429 nextCachedChunk = |
| 430 m_currentPaintArtifact.findChunkByDisplayItemIndex(nextChunkIndex); |
| 431 DCHECK(nextCachedChunk != m_currentPaintArtifact.paintChunks().end()); |
| 432 break; |
| 433 } |
| 434 } |
| 428 } | 435 } |
| 429 | 436 |
| 430 while (true) { | 437 while (true) { |
| 431 DCHECK(cachedItem->hasValidClient()); | 438 DCHECK(cachedItem->hasValidClient()); |
| 432 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 439 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 433 CHECK(cachedItem->client().isAlive()); | 440 CHECK(cachedItem->client().isAlive()); |
| 434 #endif | 441 #endif |
| 435 ++m_numCachedNewItems; | 442 ++m_numCachedNewItems; |
| 436 bool metEndSubsequence = cachedItem->getId() == endSubsequenceId; | 443 bool metEndSubsequence = cachedItem->getId() == endSubsequenceId; |
| 437 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 444 if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 438 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 445 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 439 cachedItemIndex == cachedChunk->endIndex) { | 446 nextCachedChunk != m_currentPaintArtifact.paintChunks().end() && |
| 440 ++cachedChunk; | 447 cachedItemIndex == nextCachedChunk->beginIndex) { |
| 441 DCHECK(cachedChunk != m_currentPaintArtifact.paintChunks().end()); | |
| 442 updateCurrentPaintChunkProperties( | 448 updateCurrentPaintChunkProperties( |
| 443 cachedChunk->id ? &*cachedChunk->id : nullptr, | 449 nextCachedChunk->id ? &*nextCachedChunk->id : nullptr, |
| 444 cachedChunk->properties); | 450 nextCachedChunk->properties); |
| 451 nextCachedChunk++; |
| 445 } | 452 } |
| 446 processNewItem(moveItemFromCurrentListToNewList(cachedItemIndex)); | 453 processNewItem(moveItemFromCurrentListToNewList(cachedItemIndex)); |
| 447 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 448 DCHECK((!m_newPaintChunks.lastChunk().id && !cachedChunk->id) || | |
| 449 m_newPaintChunks.lastChunk().matches(*cachedChunk)); | |
| 450 } | 454 } |
| 451 | 455 |
| 452 ++cachedItemIndex; | 456 ++cachedItemIndex; |
| 453 if (metEndSubsequence) | 457 if (metEndSubsequence) |
| 454 break; | 458 break; |
| 455 | 459 |
| 456 // We should always be able to find the EndSubsequence display item. | 460 // We should always be able to find the EndSubsequence display item. |
| 457 DCHECK(cachedItemIndex < | 461 DCHECK(cachedItemIndex < |
| 458 m_currentPaintArtifact.getDisplayItemList().size()); | 462 m_currentPaintArtifact.getDisplayItemList().size()); |
| 459 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[cachedItemIndex]; | 463 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[cachedItemIndex]; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 showPaintRecords | 865 showPaintRecords |
| 862 ? (DisplayItemList::JsonOptions::ShowPaintRecords | | 866 ? (DisplayItemList::JsonOptions::ShowPaintRecords | |
| 863 DisplayItemList::JsonOptions::ShowClientDebugName) | 867 DisplayItemList::JsonOptions::ShowClientDebugName) |
| 864 : DisplayItemList::JsonOptions::ShowClientDebugName) | 868 : DisplayItemList::JsonOptions::ShowClientDebugName) |
| 865 ->toPrettyJSONString() | 869 ->toPrettyJSONString() |
| 866 .utf8() | 870 .utf8() |
| 867 .data()); | 871 .data()); |
| 868 } | 872 } |
| 869 | 873 |
| 870 } // namespace blink | 874 } // namespace blink |
| OLD | NEW |