Commit 9072857d authored by Steve Kobes's avatar Steve Kobes Committed by Commit Bot

JankTracker logging: add URL and exclude devtools.

This tweaks the DVLOG output of JankTracker to be more useful, printing
the URL of the document in which the layout shift occurred, indicating
whether it's in a subframe, and suppressing output for devtools windows.

Bug: 581518
Change-Id: I5515137219a6ff88fb46ca9181f500e5b23c191d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1459802Reviewed-by: default avatarBryan McQuade <bmcquade@chromium.org>
Commit-Queue: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659612}
parent 8a311618
......@@ -96,6 +96,12 @@ static void RegionToTracedValue(const JankRegion& region,
RegionToTracedValue(old_region, granularity_scale, value);
}
#if DCHECK_IS_ON()
static bool ShouldLog(const LocalFrame& frame) {
return !frame.GetDocument()->Url().GetString().StartsWith("chrome-devtools:");
}
#endif
JankTracker::JankTracker(LocalFrameView* frame_view)
: frame_view_(frame_view),
score_(0.0),
......@@ -145,8 +151,15 @@ void JankTracker::AccumulateJank(const LayoutObject& source,
if (!old_rect.Intersects(viewport) && !new_rect.Intersects(viewport))
return;
DVLOG(2) << source.DebugName() << " moved from " << old_rect.ToString()
<< " to " << new_rect.ToString();
#if DCHECK_IS_ON()
LocalFrame& frame = frame_view_->GetFrame();
if (ShouldLog(frame)) {
DVLOG(2) << "in " << (frame.IsMainFrame() ? "" : "subframe ")
<< frame.GetDocument()->Url().GetString() << ", "
<< source.DebugName() << " moved from " << old_rect.ToString()
<< " to " << new_rect.ToString();
}
#endif
max_distance_ =
std::max(max_distance_, GetMoveDistance(old_rect, new_rect, source));
......@@ -249,10 +262,15 @@ void JankTracker::NotifyPrePaintFinished() {
score_ += jank_fraction;
DVLOG(1) << "viewport " << (jank_fraction * 100)
<< "% janked, raising score to " << score_;
LocalFrame& frame = frame_view_->GetFrame();
#if DCHECK_IS_ON()
if (ShouldLog(frame)) {
DVLOG(1) << "in " << (frame.IsMainFrame() ? "" : "subframe ")
<< frame.GetDocument()->Url().GetString() << ", viewport was "
<< (jank_fraction * 100) << "% janked; raising score to "
<< score_;
}
#endif
TRACE_EVENT_INSTANT2("loading", "FrameLayoutJank", TRACE_EVENT_SCOPE_THREAD,
"data",
......
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