Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 1577433003: Statistics of LayoutBox rare data reasons Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
index 8165be07c17c0a1bc1d635920683fca0955c750e..8ca9e7b88a5f30af7959b5f9750734bbadd0d2b3 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -29,6 +29,12 @@
namespace blink {
+int paints[9];
+
+int* paintCounts() {
+ return paints;
+}
+
static inline bool shouldSuppressPaintingLayer(const PaintLayer& layer) {
// Avoid painting descendants of the root layer when stylesheets haven't
// loaded. This avoids some FOUC. It's ok not to draw, because later on, when
@@ -1042,6 +1048,7 @@ void PaintLayerPainter::paintForegroundForFragments(
clipState = HasClipped;
}
+ size_t sizeBefore = context.getPaintController().newDisplayItemList().size();
// We have to loop through every fragment multiple times, since we have to
// issue paint invalidations in each specific phase in order for interleaving
// of the fragments to work properly.
@@ -1067,6 +1074,8 @@ void PaintLayerPainter::paintForegroundForFragments(
m_paintLayer.setPreviousPaintPhaseDescendantBlockBackgroundsEmpty(
phaseIsEmpty);
}
+ } else {
+ paints[6]++;
}
if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() ||
@@ -1081,6 +1090,8 @@ void PaintLayerPainter::paintForegroundForFragments(
sizeBefore;
DCHECK(phaseIsEmpty || m_paintLayer.needsPaintPhaseFloat());
m_paintLayer.setPreviousPaintPhaseFloatEmpty(phaseIsEmpty);
+ } else {
+ paints[7]++;
}
paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments,
@@ -1099,7 +1110,13 @@ void PaintLayerPainter::paintForegroundForFragments(
sizeBefore;
DCHECK(phaseIsEmpty || m_paintLayer.needsPaintPhaseDescendantOutlines());
m_paintLayer.setPreviousPaintPhaseDescendantOutlinesEmpty(phaseIsEmpty);
+ } else {
+ paints[8]++;
}
+
+ paints[5]++;
+ if (sizeBefore == context.getPaintController().newDisplayItemList().size())
+ paints[4]++;
}
}
@@ -1114,11 +1131,33 @@ void PaintLayerPainter::paintForegroundForFragmentsWithPhase(
if (layerFragments.size() > 1)
cacheSkipper.emplace(context);
+ int paintIndex = -1;
+ switch (phase) {
+ case PaintPhaseDescendantBlockBackgroundsOnly:
+ paintIndex = 0;
+ break;
+ case PaintPhaseFloat:
+ paintIndex = 1;
+ break;
+ case PaintPhaseForeground:
+ paintIndex = 2;
+ break;
+ case PaintPhaseDescendantOutlinesOnly:
+ paintIndex = 3;
+ break;
+ default:
+ break;
+ }
+
+ size_t sizeBefore = context.getPaintController().newDisplayItemList().size();
for (auto& fragment : layerFragments) {
if (!fragment.foregroundRect.isEmpty())
paintFragmentWithPhase(phase, fragment, context, fragment.foregroundRect,
localPaintingInfo, paintFlags, clipState);
}
+ if (paintIndex != -1 &&
+ sizeBefore == context.getPaintController().newDisplayItemList().size())
+ paints[paintIndex]++;
}
void PaintLayerPainter::paintSelfOutlineForFragments(

Powered by Google App Engine
This is Rietveld 408576698