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

Unified Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2309193002: Revert of Reland Compile under-invalidation checking in all builds (Closed)
Patch Set: Rebase and manually fix merge conflicts. Created 4 years, 3 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/platform/graphics/GraphicsLayer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
index 4bed0cb2668e6726052469aa96c58c95e6cc1dad..ea8d86176c4ee21bb5a102a5a1f52897d19782be 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -80,6 +80,7 @@ struct PaintInvalidationInfo {
PaintInvalidationReason reason;
};
+#if DCHECK_IS_ON()
struct UnderPaintInvalidation {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
int x;
@@ -87,13 +88,16 @@ struct UnderPaintInvalidation {
SkColor oldPixel;
SkColor newPixel;
};
+#endif
struct PaintInvalidationTracking {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
Vector<PaintInvalidationInfo> trackedPaintInvalidations;
+#if DCHECK_IS_ON()
sk_sp<SkPicture> lastPaintedPicture;
Region paintInvalidationRegionSinceLastPaint;
Vector<UnderPaintInvalidation> underPaintInvalidations;
+#endif
};
typedef HashMap<const GraphicsLayer*, PaintInvalidationTracking> PaintInvalidationTrackingMap;
@@ -332,13 +336,15 @@ void GraphicsLayer::paint(const IntRect* interestRect, GraphicsContext::Disabled
{
if (paintWithoutCommit(interestRect, disabledMode)) {
getPaintController().commitNewDisplayItems(offsetFromLayoutObjectWithSubpixelAccumulation());
- if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) {
+#if DCHECK_IS_ON()
+ if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) {
sk_sp<SkPicture> newPicture = capturePicture();
checkPaintUnderInvalidations(*newPicture);
PaintInvalidationTracking& tracking = paintInvalidationTrackingMap().add(this, PaintInvalidationTracking()).storedValue->value;
tracking.lastPaintedPicture = std::move(newPicture);
tracking.paintInvalidationRegionSinceLastPaint = Region();
}
+#endif
}
}
@@ -548,7 +554,7 @@ void GraphicsLayer::resetTrackedPaintInvalidations()
if (it == paintInvalidationTrackingMap().end())
return;
- if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled())
+ if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled())
it->value.trackedPaintInvalidations.clear();
else
paintInvalidationTrackingMap().remove(it);
@@ -574,12 +580,14 @@ void GraphicsLayer::trackPaintInvalidation(const DisplayItemClient& client, cons
tracking.trackedPaintInvalidations.append(info);
}
- if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) {
+#if DCHECK_IS_ON()
+ if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) {
// TODO(crbug.com/496260): Some antialiasing effects overflows the paint invalidation rect.
IntRect r = rect;
r.inflate(1);
tracking.paintInvalidationRegionSinceLastPaint.unite(r);
}
+#endif
}
static bool comparePaintInvalidationInfo(const PaintInvalidationInfo& a, const PaintInvalidationInfo& b)
@@ -772,7 +780,7 @@ std::unique_ptr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlag
}
json->setArray("paintInvalidations", std::move(paintInvalidationsJSON));
}
-
+#if DCHECK_IS_ON()
Vector<UnderPaintInvalidation>& underPaintInvalidations = it->value.underPaintInvalidations;
if (!underPaintInvalidations.isEmpty()) {
std::unique_ptr<JSONArray> underPaintInvalidationsJSON = JSONArray::create();
@@ -786,6 +794,7 @@ std::unique_ptr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlag
}
json->setArray("underPaintInvalidations", std::move(underPaintInvalidationsJSON));
}
+#endif
}
}
@@ -1244,6 +1253,8 @@ void GraphicsLayer::setCompositorMutableProperties(uint32_t properties)
layer->setCompositorMutableProperties(properties);
}
+#if DCHECK_IS_ON()
+
sk_sp<SkPicture> GraphicsLayer::capturePicture()
{
if (!drawsContent())
@@ -1289,19 +1300,11 @@ void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture)
int width = static_cast<int>(ceilf(std::min(tracking.lastPaintedPicture->cullRect().width(), newPicture.cullRect().width())));
int height = static_cast<int>(ceilf(std::min(tracking.lastPaintedPicture->cullRect().height(), newPicture.cullRect().height())));
oldBitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
- {
- SkCanvas canvas(oldBitmap);
- canvas.clear(SK_ColorTRANSPARENT);
- canvas.drawPicture(tracking.lastPaintedPicture.get());
- }
+ SkCanvas(oldBitmap).drawPicture(tracking.lastPaintedPicture.get());
SkBitmap newBitmap;
newBitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
- {
- SkCanvas canvas(newBitmap);
- canvas.clear(SK_ColorTRANSPARENT);
- canvas.drawPicture(&newPicture);
- }
+ SkCanvas(newBitmap).drawPicture(&newPicture);
oldBitmap.lockPixels();
newBitmap.lockPixels();
@@ -1320,7 +1323,7 @@ void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture)
LOG(ERROR) << "and more...";
}
++mismatchingPixels;
- *newBitmap.getAddr32(x, y) = SkColorSetARGB(0x80, 0xFF, 0, 0xFF); // Half translucent magenta.
+ *newBitmap.getAddr32(x, y) = SK_ColorRED;
} else {
*newBitmap.getAddr32(x, y) = SK_ColorTRANSPARENT;
}
@@ -1339,6 +1342,8 @@ void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture)
getPaintController().appendDebugDrawingAfterCommit(*this, picture, offsetFromLayoutObjectWithSubpixelAccumulation());
}
+#endif // DCHECK_IS_ON()
+
} // namespace blink
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698