Ouptut oldLocation and newLocation in trace of paint invalidation

I found that InvalidationLocationChange is a very frequent invalidation
reason for some repaint storms. The invalidation is because the
location (from the paint invalidation container) of the render object
changed since the last invalidation. It will be helpful to know how
the location changes when debugging repaint storms.

Review URL: https://codereview.chromium.org/561443002

git-svn-id: svn://svn.chromium.org/blink/trunk@181759 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8f50ffb6
...@@ -1466,6 +1466,15 @@ void addJsonObjectForRect(TracedValue* value, const char* name, const T& rect) ...@@ -1466,6 +1466,15 @@ void addJsonObjectForRect(TracedValue* value, const char* name, const T& rect)
value->endDictionary(); value->endDictionary();
} }
template <typename T>
void addJsonObjectForPoint(TracedValue* value, const char* name, const T& point)
{
value->beginDictionary(name);
value->setDouble("x", point.x());
value->setDouble("y", point.y());
value->endDictionary();
}
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvalidationInfo(const LayoutRect& rect, const String& invalidationReason) static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvalidationInfo(const LayoutRect& rect, const String& invalidationReason)
{ {
RefPtr<TracedValue> value = TracedValue::create(); RefPtr<TracedValue> value = TracedValue::create();
...@@ -1612,11 +1621,13 @@ void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat ...@@ -1612,11 +1621,13 @@ void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
} }
} }
static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRects(const LayoutRect& oldRect, const LayoutRect& newRect) static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRects(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation)
{ {
RefPtr<TracedValue> value = TracedValue::create(); RefPtr<TracedValue> value = TracedValue::create();
addJsonObjectForRect(value.get(), "old", oldRect); addJsonObjectForRect(value.get(), "oldRect", oldRect);
addJsonObjectForRect(value.get(), "new", newRect); addJsonObjectForPoint(value.get(), "oldLocation", oldLocation);
addJsonObjectForRect(value.get(), "newRect", newRect);
addJsonObjectForPoint(value.get(), "newLocation", newLocation);
return value; return value;
} }
...@@ -1641,7 +1652,7 @@ InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation ...@@ -1641,7 +1652,7 @@ InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject::invalidatePaintIfNeeded()", TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject::invalidatePaintIfNeeded()",
"object", this->debugName().ascii(), "object", this->debugName().ascii(),
"info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, newLocation));
InvalidationReason invalidationReason = getPaintInvalidationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newLocation); InvalidationReason invalidationReason = getPaintInvalidationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newLocation);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment