| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 --m_underInvalidationCheckingBegin; | 148 --m_underInvalidationCheckingBegin; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 #endif | 151 #endif |
| 152 m_newDisplayItemList.removeLast(); | 152 m_newDisplayItemList.removeLast(); |
| 153 | 153 |
| 154 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 154 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 155 m_newPaintChunks.decrementDisplayItemIndex(); | 155 m_newPaintChunks.decrementDisplayItemIndex(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 const DisplayItem* PaintController::lastDisplayItem(unsigned offset) |
| 159 { |
| 160 if (offset < m_newDisplayItemList.size()) |
| 161 return &m_newDisplayItemList[m_newDisplayItemList.size() - offset - 1]; |
| 162 return nullptr; |
| 163 } |
| 164 |
| 158 void PaintController::processNewItem(DisplayItem& displayItem) | 165 void PaintController::processNewItem(DisplayItem& displayItem) |
| 159 { | 166 { |
| 160 DCHECK(!m_constructionDisabled); | 167 DCHECK(!m_constructionDisabled); |
| 161 | 168 |
| 162 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 169 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 163 if (!isSkippingCache()) { | 170 if (!isSkippingCache()) { |
| 164 if (displayItem.isCacheable()) { | 171 if (displayItem.isCacheable()) { |
| 165 // Mark the client shouldKeepAlive under this PaintController. | 172 // Mark the client shouldKeepAlive under this PaintController. |
| 166 // The status will end after the new display items are committed. | 173 // The status will end after the new display items are committed. |
| 167 displayItem.client().beginShouldKeepAlive(this); | 174 displayItem.client().beginShouldKeepAlive(this); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 { | 542 { |
| 536 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled
()); | 543 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled
()); |
| 537 | 544 |
| 538 if (!isCheckingUnderInvalidation()) | 545 if (!isCheckingUnderInvalidation()) |
| 539 return; | 546 return; |
| 540 | 547 |
| 541 const DisplayItem& newItem = m_newDisplayItemList.last(); | 548 const DisplayItem& newItem = m_newDisplayItemList.last(); |
| 542 size_t oldItemIndex = m_underInvalidationCheckingBegin + m_skippedProbableUn
derInvalidationCount; | 549 size_t oldItemIndex = m_underInvalidationCheckingBegin + m_skippedProbableUn
derInvalidationCount; |
| 543 const DisplayItem* oldItem = oldItemIndex < m_currentPaintArtifact.getDispla
yItemList().size() ? &m_currentPaintArtifact.getDisplayItemList()[oldItemIndex]
: nullptr; | 550 const DisplayItem* oldItem = oldItemIndex < m_currentPaintArtifact.getDispla
yItemList().size() ? &m_currentPaintArtifact.getDisplayItemList()[oldItemIndex]
: nullptr; |
| 544 | 551 |
| 545 if (newItem.isCacheable() && !clientCacheIsValid(newItem.client())) { | |
| 546 showUnderInvalidationError("under-invalidation of PaintLayer: invalidate
d in cached subsequence", newItem, oldItem); | |
| 547 NOTREACHED(); | |
| 548 } | |
| 549 | |
| 550 bool oldAndNewEqual = oldItem && newItem.equals(*oldItem); | 552 bool oldAndNewEqual = oldItem && newItem.equals(*oldItem); |
| 551 if (!oldAndNewEqual) { | 553 if (!oldAndNewEqual) { |
| 552 if (newItem.isBegin()) { | 554 if (newItem.isBegin()) { |
| 553 // Temporarily skip mismatching begin display item which may be remo
ved when we remove a no-op pair. | 555 // Temporarily skip mismatching begin display item which may be remo
ved when we remove a no-op pair. |
| 554 ++m_skippedProbableUnderInvalidationCount; | 556 ++m_skippedProbableUnderInvalidationCount; |
| 555 return; | 557 return; |
| 556 } | 558 } |
| 557 if (newItem.isDrawing() && m_skippedProbableUnderInvalidationCount == 1)
{ | 559 if (newItem.isDrawing() && m_skippedProbableUnderInvalidationCount == 1)
{ |
| 558 DCHECK_GE(m_newDisplayItemList.size(), 2u); | 560 DCHECK_GE(m_newDisplayItemList.size(), 2u); |
| 559 if (m_newDisplayItemList[m_newDisplayItemList.size() - 2].getType()
== DisplayItem::BeginCompositing) { | 561 if (m_newDisplayItemList[m_newDisplayItemList.size() - 2].getType()
== DisplayItem::BeginCompositing) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 609 |
| 608 void PaintController::showDebugData() const | 610 void PaintController::showDebugData() const |
| 609 { | 611 { |
| 610 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); | 612 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); |
| 611 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); | 613 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); |
| 612 } | 614 } |
| 613 | 615 |
| 614 #endif // ifndef NDEBUG | 616 #endif // ifndef NDEBUG |
| 615 | 617 |
| 616 } // namespace blink | 618 } // namespace blink |
| OLD | NEW |