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 ebd50c5e7910d325ed1db68c9448b3eb8109c6c8..b55b5e3467b378bc6eade222a0eccfba5035d587 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp |
@@ -16,6 +16,8 @@ |
#include <stdio.h> |
#endif |
+static constexpr int maxNumberOfSlowPathsBeforeVeto = 5; |
+ |
namespace blink { |
void PaintController::setTracksRasterInvalidations(bool value) { |
@@ -503,15 +505,15 @@ void PaintController::commitNewDisplayItems( |
!m_newDisplayItemList.isEmpty()) |
generateChunkRasterInvalidationRects(m_newPaintChunks.lastChunk()); |
- SkPictureGpuAnalyzer gpuAnalyzer; |
+ int numSlowPaths = 0; |
m_currentCacheGeneration = |
DisplayItemClient::CacheGenerationOrInvalidationReason::next(); |
Vector<const DisplayItemClient*> skippedCacheClients; |
for (const auto& item : m_newDisplayItemList) { |
// No reason to continue the analysis once we have a veto. |
- if (gpuAnalyzer.suitableForGpuRasterization()) |
- item.analyzeForGpuRasterization(gpuAnalyzer); |
+ if (numSlowPaths <= maxNumberOfSlowPathsBeforeVeto) |
+ numSlowPaths += item.numberOfSlowPaths(); |
// TODO(wkorman): Only compute and append visual rect for drawings. |
m_newDisplayItemList.appendVisualRect( |
@@ -549,7 +551,7 @@ void PaintController::commitNewDisplayItems( |
m_newDisplayItemList.shrinkToFit(); |
m_currentPaintArtifact = PaintArtifact( |
std::move(m_newDisplayItemList), m_newPaintChunks.releasePaintChunks(), |
- gpuAnalyzer.suitableForGpuRasterization()); |
+ numSlowPaths <= maxNumberOfSlowPathsBeforeVeto); |
resetCurrentListIndices(); |
m_outOfOrderItemIndices.clear(); |
m_outOfOrderChunkIndices.clear(); |