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

Unified Diff: components/page_load_metrics/browser/page_load_metrics_util.cc

Issue 1918373002: Metrics for document.write script blocking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback incorporated. Created 4 years, 8 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
Index: components/page_load_metrics/browser/page_load_metrics_util.cc
diff --git a/components/page_load_metrics/browser/page_load_metrics_util.cc b/components/page_load_metrics/browser/page_load_metrics_util.cc
index dbfa35ebad04390d702be6642f8a546ce3715e76..835ca5d3d53e14b94cc93e02dbc62532d082ecab 100644
--- a/components/page_load_metrics/browser/page_load_metrics_util.cc
+++ b/components/page_load_metrics/browser/page_load_metrics_util.cc
@@ -11,11 +11,27 @@
namespace page_load_metrics {
-bool WasStartedInForegroundEventInForeground(base::TimeDelta event,
+bool WasStartedInForegroundEventInForeground(const base::TimeDelta& event,
const PageLoadExtraInfo& info) {
return info.started_in_foreground && !event.is_zero() &&
(info.first_background_time.is_zero() ||
event < info.first_background_time);
}
+bool WasParseInForeground(const base::TimeDelta& parse_start,
+ const base::TimeDelta& parse_stop,
+ const PageLoadExtraInfo& info) {
+ if (parse_start.is_zero()) {
+ return false;
+ }
+ // If the parse did not complete but the entire page load duration happened
+ // in the foreground, or if the parse completed and happened entirely in the
+ // foreground, record a foreground histogram.
jkarlin 2016/04/27 14:28:16 This comment belongs in the header.
shivanisha 2016/04/27 15:34:38 Moved.
+ const bool incomplete_parse_in_foreground =
+ parse_stop.is_zero() && info.started_in_foreground &&
+ info.first_background_time.is_zero();
+
+ return incomplete_parse_in_foreground ||
+ WasStartedInForegroundEventInForeground(parse_stop, info);
+}
} // namespace page_load_metrics

Powered by Google App Engine
This is Rietveld 408576698