Index: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
index ba87f0278c47ca356ad4304f16b0597ccc68760c..b18c2a16609a74d0189fa255d766f8f7e86d1a15 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
@@ -112,6 +112,18 @@ |
return m_newPaintChunks.currentPaintChunkProperties(); |
} |
+void PaintController::displayItemClientWasInvalidated(const DisplayItemClient& client) |
+{ |
+#if DCHECK_IS_ON() |
+ // Slimming paint v1 CompositedLayerMapping may invalidate client on extra layers. |
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() || clientCacheIsValid(client)) |
+ m_invalidations.append(client.debugName()); |
+ |
+ // Should not invalidate already painted clients. |
+ DCHECK(!m_newDisplayItemIndicesByClient.contains(&client)); |
+#endif |
+} |
+ |
void PaintController::invalidateAll() |
{ |
// Can only be called during layout/paintInvalidation, not during painting. |
@@ -129,6 +141,26 @@ |
return false; |
return client.displayItemsAreCached(m_currentCacheGeneration); |
} |
+ |
+void PaintController::invalidatePaintOffset(const DisplayItemClient& client) |
+{ |
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
+ displayItemClientWasInvalidated(client); |
+ client.setDisplayItemsUncached(); |
+ |
+#if DCHECK_IS_ON() |
+ DCHECK(!paintOffsetWasInvalidated(client)); |
+ m_clientsWithPaintOffsetInvalidations.add(&client); |
+#endif |
+} |
+ |
+#if DCHECK_IS_ON() |
+bool PaintController::paintOffsetWasInvalidated(const DisplayItemClient& client) const |
+{ |
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
+ return m_clientsWithPaintOffsetInvalidations.contains(&client); |
+} |
+#endif |
size_t PaintController::findMatchingItemFromIndex(const DisplayItem::Id& id, const DisplayItemIndicesByClientMap& displayItemIndicesByClient, const DisplayItemList& list) |
{ |
@@ -237,6 +269,8 @@ |
DCHECK(!skippingCache()); |
#if DCHECK_IS_ON() |
m_newDisplayItemIndicesByClient.clear(); |
+ m_clientsWithPaintOffsetInvalidations.clear(); |
+ m_invalidations.clear(); |
#endif |
SkPictureGpuAnalyzer gpuAnalyzer; |
@@ -279,8 +313,10 @@ |
bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matches(*currentIt); |
if (newDisplayItemHasCachedType) { |
+#if DCHECK_IS_ON() |
DCHECK(newDisplayItem.isCached()); |
- DCHECK(clientCacheIsValid(newDisplayItem.client())); |
+ DCHECK(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && !paintOffsetWasInvalidated(newDisplayItem.client()))); |
+#endif |
if (!isSynchronized) { |
currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrderIndexContext); |
@@ -312,9 +348,12 @@ |
DCHECK(updatedList.last().getType() == DisplayItem::EndSubsequence); |
} |
} else { |
+#if DCHECK_IS_ON() |
DCHECK(!newDisplayItem.isDrawing() |
|| newDisplayItem.skippedCache() |
- || !clientCacheIsValid(newDisplayItem.client())); |
+ || !clientCacheIsValid(newDisplayItem.client()) |
+ || (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); |
+#endif |
updatedList.appendByMoving(*newIt, visualRectForDisplayItem(*newIt, offsetFromLayoutObject), gpuAnalyzer); |