Chromium Code Reviews| 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 e28a4a3ce7d34e8e40a66a782573224431da5357..74454b1502a0db39e2c18a244527b166585c47ce 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,35 @@ |
| namespace page_load_metrics { |
| -bool EventOccurredInForeground(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); |
| +namespace { |
| + |
| +// Returns true if: |
| +// - We have timing information for the event. |
| +// - The event occurred prior to the page being moved to the background. |
| +bool InForeground(base::TimeDelta event, const PageLoadExtraInfo& info) { |
|
Bryan McQuade
2016/02/24 19:34:44
i'm not super keen on this change. I think you're
|
| + if (event.is_zero()) |
| + return false; |
| + |
| + if (!info.started_in_foreground && |
| + (info.first_foreground_time.is_zero() || |
| + event < info.first_foreground_time)) { |
| + return false; |
| + } |
| + |
| + return info.first_background_time.is_zero() || |
| + event < info.first_background_time; |
| +} |
| + |
| +} // namespace |
| + |
| +bool WasStartedInForegroundEventInForeground(base::TimeDelta event, |
| + const PageLoadExtraInfo& info) { |
| + return info.started_in_foreground && InForeground(event, info); |
| +} |
| + |
| +bool WasStartedInBackgroundEventInForeground(base::TimeDelta event, |
|
Bryan McQuade
2016/02/24 21:31:53
So, this is going to be disappointing, but I'd lik
pkotwicz
2016/02/24 22:03:55
Can you discuss with csharrison@? Patch set #1 doe
Bryan McQuade
2016/02/24 23:45:57
I think I saw the comment you're referring to - Ch
|
| + const PageLoadExtraInfo& info) { |
| + return !info.started_in_foreground && InForeground(event, info); |
| } |
| } // namespace page_load_metrics |