| Index: chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
| diff --git a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
| index 612e5cca70428eb8a38deaebfdff20fecf98aa2e..10fdbda49404aaadca391ba676869028883a8909 100644
|
| --- a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
| +++ b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
| @@ -130,23 +130,29 @@ void LogProvisionalAborts(UserAbortType abort_type,
|
| }
|
| }
|
|
|
| -bool WasAbortedInForeground(UserAbortType abort_type,
|
| - base::TimeDelta time_to_abort,
|
| - const page_load_metrics::PageLoadExtraInfo& info) {
|
| - if (time_to_abort.is_zero())
|
| +bool WasAbortedInForeground(
|
| + UserAbortType abort_type,
|
| + const base::Optional<base::TimeDelta>& time_to_abort,
|
| + const page_load_metrics::PageLoadExtraInfo& info) {
|
| + if (!time_to_abort)
|
| return false;
|
| if (abort_type == UserAbortType::ABORT_NONE)
|
| return false;
|
| - if (WasStartedInForegroundEventInForeground(time_to_abort, info))
|
| + if (WasStartedInForegroundOptionalEventInForeground(time_to_abort, info))
|
| return true;
|
| if (!info.started_in_foreground)
|
| return false;
|
| - DCHECK_GT(time_to_abort, info.first_background_time);
|
| - base::TimeDelta bg_abort_delta = time_to_abort - info.first_background_time;
|
| +
|
| + const base::TimeDelta time_to_abort_val = time_to_abort.value();
|
| + const base::TimeDelta time_to_first_background =
|
| + info.first_background_time.value();
|
| + DCHECK_GT(time_to_abort_val, time_to_first_background);
|
| + base::TimeDelta background_abort_delta =
|
| + time_to_abort_val - time_to_first_background;
|
| // Consider this a foregrounded abort if it occurred within 100ms of a
|
| // background. This is needed for closing some tabs, where the signal for
|
| // background is often slightly ahead of the signal for close.
|
| - if (bg_abort_delta.InMilliseconds() < 100)
|
| + if (background_abort_delta.InMilliseconds() < 100)
|
| return true;
|
| return false;
|
| }
|
| @@ -397,19 +403,21 @@ void FromGWSPageLoadMetricsLogger::OnComplete(
|
| // consistency with core PageLoad metrics, we ignore non-render-tracked
|
| // loads when tracking aborts after commit.
|
| UserAbortType abort_type = extra_info.abort_type;
|
| - base::TimeDelta time_to_abort = extra_info.time_to_abort;
|
| bool aborted_in_foreground =
|
| - WasAbortedInForeground(abort_type, time_to_abort, extra_info);
|
| + WasAbortedInForeground(abort_type, extra_info.time_to_abort, extra_info);
|
| +
|
| + const base::Optional<base::TimeDelta>& time_to_abort =
|
| + extra_info.time_to_abort;
|
|
|
| if (!extra_info.committed_url.is_empty()) {
|
| - bool aborted_before_paint =
|
| - aborted_in_foreground && !timing.IsEmpty() &&
|
| - (timing.first_paint.is_zero() || timing.first_paint >= time_to_abort);
|
| + bool aborted_before_paint = aborted_in_foreground && !timing.IsEmpty() &&
|
| + (timing.first_paint.is_zero() ||
|
| + timing.first_paint >= time_to_abort.value());
|
| if (aborted_before_paint)
|
| - LogCommittedAbortsBeforePaint(abort_type, time_to_abort);
|
| + LogCommittedAbortsBeforePaint(abort_type, time_to_abort.value());
|
| } else {
|
| if (aborted_in_foreground)
|
| - LogProvisionalAborts(abort_type, time_to_abort);
|
| + LogProvisionalAborts(abort_type, time_to_abort.value());
|
| }
|
| }
|
|
|
|
|