| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 m_newPaintChunks.decrementDisplayItemIndex(); | 60 m_newPaintChunks.decrementDisplayItemIndex(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void PaintController::processNewItem(DisplayItem& displayItem) | 63 void PaintController::processNewItem(DisplayItem& displayItem) |
| 64 { | 64 { |
| 65 DCHECK(!m_constructionDisabled); | 65 DCHECK(!m_constructionDisabled); |
| 66 DCHECK(!skippingCache() || !displayItem.isCached()); | 66 DCHECK(!skippingCache() || !displayItem.isCached()); |
| 67 | 67 |
| 68 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 68 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 69 if (!skippingCache() && (displayItem.isCacheable() || displayItem.isCached()
)) | 69 if (!skippingCache() && (displayItem.isCacheable() || displayItem.isCached()
)) |
| 70 displayItem.client().beginShouldKeepAlive(); | 70 displayItem.client().beginShouldKeepAlive(this); |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 if (displayItem.isCached()) | 73 if (displayItem.isCached()) |
| 74 ++m_numCachedNewItems; | 74 ++m_numCachedNewItems; |
| 75 | 75 |
| 76 #if DCHECK_IS_ON() | 76 #if DCHECK_IS_ON() |
| 77 // Verify noop begin/end pairs have been removed. | 77 // Verify noop begin/end pairs have been removed. |
| 78 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { | 78 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { |
| 79 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList
.size() - 2]; | 79 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList
.size() - 2]; |
| 80 if (beginDisplayItem.isBegin() && beginDisplayItem.getType() != DisplayI
tem::Subsequence && !beginDisplayItem.drawsContent()) | 80 if (beginDisplayItem.isBegin() && beginDisplayItem.getType() != DisplayI
tem::Subsequence && !beginDisplayItem.drawsContent()) |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 void PaintController::updateCacheGeneration() | 403 void PaintController::updateCacheGeneration() |
| 404 { | 404 { |
| 405 m_currentCacheGeneration = DisplayItemCacheGeneration::next(); | 405 m_currentCacheGeneration = DisplayItemCacheGeneration::next(); |
| 406 for (const DisplayItem& displayItem : m_currentPaintArtifact.getDisplayItemL
ist()) { | 406 for (const DisplayItem& displayItem : m_currentPaintArtifact.getDisplayItemL
ist()) { |
| 407 if (!displayItem.isCacheable()) | 407 if (!displayItem.isCacheable()) |
| 408 continue; | 408 continue; |
| 409 displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); | 409 displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); |
| 410 } | 410 } |
| 411 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 411 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 412 DisplayItemClient::endShouldKeepAliveAllClients(); | 412 DisplayItemClient::endShouldKeepAliveAllClients(this); |
| 413 #endif | 413 #endif |
| 414 } | 414 } |
| 415 | 415 |
| 416 #if DCHECK_IS_ON() | 416 #if DCHECK_IS_ON() |
| 417 | 417 |
| 418 void PaintController::checkUnderInvalidation(DisplayItemList::iterator& newIt, D
isplayItemList::iterator& currentIt) | 418 void PaintController::checkUnderInvalidation(DisplayItemList::iterator& newIt, D
isplayItemList::iterator& currentIt) |
| 419 { | 419 { |
| 420 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled
()); | 420 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled
()); |
| 421 DCHECK(newIt->isCached()); | 421 DCHECK(newIt->isCached()); |
| 422 | 422 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 536 |
| 537 void PaintController::showDebugData() const | 537 void PaintController::showDebugData() const |
| 538 { | 538 { |
| 539 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); | 539 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); |
| 540 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); | 540 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); |
| 541 } | 541 } |
| 542 | 542 |
| 543 #endif // ifndef NDEBUG | 543 #endif // ifndef NDEBUG |
| 544 | 544 |
| 545 } // namespace blink | 545 } // namespace blink |
| OLD | NEW |