| 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/TraceEvent.h" | 7 #include "platform/TraceEvent.h" |
| 8 #include "platform/graphics/GraphicsLayer.h" | 8 #include "platform/graphics/GraphicsLayer.h" |
| 9 #include "platform/graphics/paint/DrawingDisplayItem.h" | 9 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 // These data structures are used during painting only. | 414 // These data structures are used during painting only. |
| 415 DCHECK(!isSkippingCache()); | 415 DCHECK(!isSkippingCache()); |
| 416 #if DCHECK_IS_ON() | 416 #if DCHECK_IS_ON() |
| 417 m_newDisplayItemIndicesByClient.clear(); | 417 m_newDisplayItemIndicesByClient.clear(); |
| 418 #endif | 418 #endif |
| 419 | 419 |
| 420 SkPictureGpuAnalyzer gpuAnalyzer; | 420 SkPictureGpuAnalyzer gpuAnalyzer; |
| 421 | 421 |
| 422 m_currentCacheGeneration = DisplayItemClient::CacheGenerationOrInvalidationR
eason::next(); | 422 m_currentCacheGeneration = DisplayItemClient::CacheGenerationOrInvalidationR
eason::next(); |
| 423 Vector<const DisplayItemClient*> skippedCacheClients; |
| 423 for (const auto& item : m_newDisplayItemList) { | 424 for (const auto& item : m_newDisplayItemList) { |
| 424 // No reason to continue the analysis once we have a veto. | 425 // No reason to continue the analysis once we have a veto. |
| 425 if (gpuAnalyzer.suitableForGpuRasterization()) | 426 if (gpuAnalyzer.suitableForGpuRasterization()) |
| 426 item.analyzeForGpuRasterization(gpuAnalyzer); | 427 item.analyzeForGpuRasterization(gpuAnalyzer); |
| 427 | 428 |
| 428 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item, off
setFromLayoutObject)); | 429 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item, off
setFromLayoutObject)); |
| 429 | 430 |
| 430 if (item.isCacheable()) | 431 if (item.isCacheable()) { |
| 431 item.client().setDisplayItemsCached(m_currentCacheGeneration); | 432 item.client().setDisplayItemsCached(m_currentCacheGeneration); |
| 433 } else { |
| 434 if (item.client().isJustCreated()) |
| 435 item.client().clearIsJustCreated(); |
| 436 if (item.skippedCache()) |
| 437 skippedCacheClients.append(&item.client()); |
| 438 } |
| 432 } | 439 } |
| 433 | 440 |
| 441 for (auto* client : skippedCacheClients) |
| 442 client->setDisplayItemsUncached(); |
| 443 |
| 434 // The new list will not be appended to again so we can release unused memor
y. | 444 // The new list will not be appended to again so we can release unused memor
y. |
| 435 m_newDisplayItemList.shrinkToFit(); | 445 m_newDisplayItemList.shrinkToFit(); |
| 436 m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList), m_ne
wPaintChunks.releasePaintChunks(), gpuAnalyzer.suitableForGpuRasterization()); | 446 m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList), m_ne
wPaintChunks.releasePaintChunks(), gpuAnalyzer.suitableForGpuRasterization()); |
| 437 resetCurrentListIndices(); | 447 resetCurrentListIndices(); |
| 438 m_outOfOrderItemIndices.clear(); | 448 m_outOfOrderItemIndices.clear(); |
| 439 | 449 |
| 440 for (const auto& chunk : m_currentPaintArtifact.paintChunks()) { | 450 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 441 if (chunk.id) | 451 for (const auto& chunk : m_currentPaintArtifact.paintChunks()) { |
| 442 chunk.id->client.setDisplayItemsCached(m_currentCacheGeneration); | 452 if (chunk.id && chunk.id->client.isJustCreated()) |
| 453 chunk.id->client.clearIsJustCreated(); |
| 454 } |
| 443 } | 455 } |
| 444 | 456 |
| 445 // We'll allocate the initial buffer when we start the next paint. | 457 // We'll allocate the initial buffer when we start the next paint. |
| 446 m_newDisplayItemList = DisplayItemList(0); | 458 m_newDisplayItemList = DisplayItemList(0); |
| 447 | 459 |
| 448 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 460 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 449 CHECK(m_currentSubsequenceClients.isEmpty()); | 461 CHECK(m_currentSubsequenceClients.isEmpty()); |
| 450 DisplayItemClient::endShouldKeepAliveAllClients(this); | 462 DisplayItemClient::endShouldKeepAliveAllClients(this); |
| 451 #endif | 463 #endif |
| 452 | 464 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 | 576 |
| 565 void PaintController::showDebugData() const | 577 void PaintController::showDebugData() const |
| 566 { | 578 { |
| 567 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); | 579 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); |
| 568 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); | 580 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); |
| 569 } | 581 } |
| 570 | 582 |
| 571 #endif // ifndef NDEBUG | 583 #endif // ifndef NDEBUG |
| 572 | 584 |
| 573 } // namespace blink | 585 } // namespace blink |
| OLD | NEW |