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..3783eb75abb63ab093464ae8f30d5df4daacbbb5 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, |
Bryan McQuade
2017/06/08 17:47:12
i'd rather not use PageLoad as the prefix here, as
Kunihiko Sakamoto
2017/06/09 05:48:16
Thanks for the suggestions, renamed to PageLoad.In
|
+ ("PageLoad.Experimental.Renderer.PaintTiming." |
+ "HadUserInputBeforeFirstMeaningfulPaint", |
+ kHadUserInputEnumMax)); |
+ |
+ if (GetFrame()->IsMainFrame()) |
+ had_user_input_histogram.Count(had_input ? kHadUserInput : kNoUserInput); |
} |
void PaintTiming::NotifyPaint(bool is_first_paint, |