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 96217bf00cd7df8399659dad5f9f67de77ce7a9d..f12ac2485f932f80b8e422294508907566dffab4 100644 |
--- a/components/page_load_metrics/browser/page_load_metrics_util.cc |
+++ b/components/page_load_metrics/browser/page_load_metrics_util.cc |
@@ -11,16 +11,6 @@ |
namespace page_load_metrics { |
-bool WasStartedInForegroundEventInForeground(base::TimeDelta event, |
- const PageLoadExtraInfo& info) { |
- return info.started_in_foreground && !event.is_zero() && |
- (!info.first_background_time || |
- event <= info.first_background_time.value()); |
-} |
- |
-// TODO (shivanisha) The above function is used for TimeDeltas coming over IPC. |
-// Merge these two when page_load_metrics only handles Optional TimeDelta |
-// values in the browser process. |
bool WasStartedInForegroundOptionalEventInForeground( |
const base::Optional<base::TimeDelta>& event, |
const PageLoadExtraInfo& info) { |
@@ -29,17 +19,16 @@ bool WasStartedInForegroundOptionalEventInForeground( |
event.value() <= info.first_background_time.value()); |
} |
-bool WasParseInForeground(base::TimeDelta parse_start, |
- base::TimeDelta parse_stop, |
+bool WasParseInForeground(const base::Optional<base::TimeDelta>& parse_start, |
+ const base::Optional<base::TimeDelta>& parse_stop, |
const PageLoadExtraInfo& info) { |
- if (parse_start.is_zero()) { |
+ if (!parse_start) { |
return false; |
} |
- const bool incomplete_parse_in_foreground = parse_stop.is_zero() && |
- info.started_in_foreground && |
- !info.first_background_time; |
+ const bool incomplete_parse_in_foreground = |
+ !parse_stop && info.started_in_foreground && !info.first_background_time; |
return incomplete_parse_in_foreground || |
- WasStartedInForegroundEventInForeground(parse_stop, info); |
+ WasStartedInForegroundOptionalEventInForeground(parse_stop, info); |
} |
} // namespace page_load_metrics |