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

Unified Diff: third_party/WebKit/Source/core/paint/PaintTiming.cpp

Issue 2883273003: Move the user interaction policy for FirstMeaningfulPaint UMA into renderer (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintTiming.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7cf83ef93b2850bc4e77e587d6d99db52db96e81..28163c97212c77566d20d8e73c6fe4be91ea1850 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,35 @@ void PaintTiming::SetFirstMeaningfulPaintCandidate(double timestamp) {
}
}
-void PaintTiming::SetFirstMeaningfulPaint(double stamp) {
+void PaintTiming::SetFirstMeaningfulPaint(
+ double stamp,
+ FirstMeaningfulPaintDetector::HadUserInput had_input) {
DCHECK_EQ(first_meaningful_paint_, 0.0);
- first_meaningful_paint_ = stamp;
- TRACE_EVENT_MARK_WITH_TIMESTAMP1(
- "loading,rail,devtools.timeline", "firstMeaningfulPaint",
- TraceEvent::ToTraceTimestamp(first_meaningful_paint_), "frame",
- GetFrame());
- NotifyPaintTimingChanged();
- RegisterNotifySwapTime(PaintEvent::kFirstMeaningfulPaint);
+ TRACE_EVENT_MARK_WITH_TIMESTAMP2("loading,rail,devtools.timeline",
+ "firstMeaningfulPaint",
+ TraceEvent::ToTraceTimestamp(stamp), "frame",
+ GetFrame(), "afterUserInput", had_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 (had_input == FirstMeaningfulPaintDetector::kNoUserInput) {
+ first_meaningful_paint_ = stamp;
+ NotifyPaintTimingChanged();
+ RegisterNotifySwapTime(PaintEvent::kFirstMeaningfulPaint);
+ }
+
+ ReportUserInputHistogram(had_input);
+}
+
+void PaintTiming::ReportUserInputHistogram(
+ FirstMeaningfulPaintDetector::HadUserInput had_input) {
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, had_user_input_histogram,
+ ("PageLoad.Internal.PaintTiming."
+ "HadUserInputBeforeFirstMeaningfulPaint",
+ FirstMeaningfulPaintDetector::kHadUserInputEnumMax));
+
+ if (GetFrame() && GetFrame()->IsMainFrame())
+ had_user_input_histogram.Count(had_input);
}
void PaintTiming::NotifyPaint(bool is_first_paint,
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintTiming.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698