Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 1686643002: Add metric with time between background tab being foregrounded and the first paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/page_load_metrics/browser/metrics_web_contents_observer.cc
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
index 5ca418e271de989d0e38c62fb8fb3c904efb6dfb..1271275c888356e7f288989121df0a0781fd6096 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -128,14 +128,13 @@ PageLoadTracker::~PageLoadTracker() {
void PageLoadTracker::WebContentsHidden() {
// Only log the first time we background in a given page load.
- if (started_in_foreground_ && background_time_.is_null())
+ if (background_time_.is_null())
background_time_ = base::TimeTicks::Now();
}
void PageLoadTracker::WebContentsShown() {
// Only log the first time we foreground in a given page load.
- // Don't log foreground time if we started foregrounded.
- if (!started_in_foreground_ && foreground_time_.is_null())
+ if (foreground_time_.is_null())
foreground_time_ = base::TimeTicks::Now();
}
@@ -195,9 +194,9 @@ PageLoadExtraInfo PageLoadTracker::GetPageLoadMetricsInfo() {
base::TimeDelta first_foreground_time;
base::TimeDelta time_to_abort;
base::TimeDelta time_to_commit;
- if (!background_time_.is_null() && started_in_foreground_)
+ if (!background_time_.is_null())
first_background_time = background_time_ - navigation_start_;
- if (!foreground_time_.is_null() && !started_in_foreground_)
+ if (!foreground_time_.is_null())
first_foreground_time = foreground_time_ - navigation_start_;
if (abort_type_ != ABORT_NONE) {
DCHECK_GT(abort_time_, navigation_start_);

Powered by Google App Engine
This is Rietveld 408576698