| 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..211489c6afb4ffd377412261a83cd968ca47e19b 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,25 @@
|
|
|
| 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);
|
| + (!info.first_background_time ||
|
| + event <= info.first_background_time.value());
|
| +}
|
| +
|
| +// TODO (@shivanisha) Since the above function is called for
|
| +// TimeDelta coming over IPC (PageLoadTiming) and since Optional is not
|
| +// currently supported in IPC, thus creating another function.
|
| +// They should ideally converge to one function in the future
|
| +// when either the serialization framework supports Optional or we send
|
| +// actual timestamps over IPC and compute deltas in browser process.
|
| +bool WasStartedInForegroundOptionalEventInForeground(
|
| + const base::Optional<base::TimeDelta>& event,
|
| + const PageLoadExtraInfo& info) {
|
| + return info.started_in_foreground && event &&
|
| + (!info.first_background_time ||
|
| + event.value() <= info.first_background_time.value());
|
| }
|
|
|
| } // namespace page_load_metrics
|
|
|