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 |