| Index: third_party/WebKit/Source/core/paint/PaintTiming.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintTiming.cpp b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
|
| index 3e7c53c2724f428d4395d3cc66ee5f5340e128e9..40fc4acb9c46ee9cd7519cad4162f0b474eb2396 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
|
| @@ -14,6 +14,7 @@
|
| #include "core/page/Page.h"
|
| #include "core/timing/DOMWindowPerformance.h"
|
| #include "core/timing/Performance.h"
|
| +#include "platform/Histogram.h"
|
| #include "platform/WebFrameScheduler.h"
|
| #include "platform/instrumentation/tracing/TraceEvent.h"
|
| #include "public/platform/WebLayerTreeView.h"
|
| @@ -96,15 +97,34 @@ void PaintTiming::SetFirstMeaningfulPaintCandidate(double timestamp) {
|
| }
|
| }
|
|
|
| -void PaintTiming::SetFirstMeaningfulPaint(double stamp) {
|
| +void PaintTiming::SetFirstMeaningfulPaint(double stamp,
|
| + bool was_after_user_input) {
|
| DCHECK_EQ(first_meaningful_paint_, 0.0);
|
| - first_meaningful_paint_ = stamp;
|
| - TRACE_EVENT_MARK_WITH_TIMESTAMP1(
|
| + TRACE_EVENT_MARK_WITH_TIMESTAMP2(
|
| "loading,rail,devtools.timeline", "firstMeaningfulPaint",
|
| - TraceEvent::ToTraceTimestamp(first_meaningful_paint_), "frame",
|
| - GetFrame());
|
| - NotifyPaintTimingChanged();
|
| - RegisterNotifySwapTime(PaintEvent::kFirstMeaningfulPaint);
|
| + TraceEvent::ToTraceTimestamp(stamp), "frame", GetFrame(),
|
| + "afterUserInput", was_after_user_input);
|
| +
|
| + // Notify FMP for UMA only if there's no user input before FMP, so that layout
|
| + // changes caused by user interactions wouldn't be considered as FMP.
|
| + if (!was_after_user_input) {
|
| + first_meaningful_paint_ = stamp;
|
| + NotifyPaintTimingChanged();
|
| + RegisterNotifySwapTime(PaintEvent::kFirstMeaningfulPaint);
|
| + }
|
| +
|
| + ReportUserInputHistogram(was_after_user_input);
|
| +}
|
| +
|
| +void PaintTiming::ReportUserInputHistogram(bool had_input) {
|
| + enum HadUserInput { kNoUserInput, kHadUserInput, kHadUserInputEnumMax };
|
| + DEFINE_STATIC_LOCAL(EnumerationHistogram, had_user_input_histogram,
|
| + ("PageLoad.Internal.PaintTiming."
|
| + "HadUserInputBeforeFirstMeaningfulPaint",
|
| + kHadUserInputEnumMax));
|
| +
|
| + if (GetFrame() && GetFrame()->IsMainFrame())
|
| + had_user_input_histogram.Count(had_input ? kHadUserInput : kNoUserInput);
|
| }
|
|
|
| void PaintTiming::NotifyPaint(bool is_first_paint,
|
|
|