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

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

Issue 1857443002: Plumb experiment flags through page_load_metrics and add a new observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page_load_experiments
Patch Set: No need to add Default group to variation config Created 4 years, 8 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 50f071523618a7aacccb39df8d8be58ab9d56d44..e998a816a15aaf54b23a12f059abd98808abaec5 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -323,7 +323,8 @@ void PageLoadTracker::Redirect(content::NavigationHandle* navigation_handle) {
}
}
-bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing) {
+bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing,
+ const PageLoadMetadata& new_metadata) {
// Throw away IPCs that are not relevant to the current navigation.
// Two timing structures cannot refer to the same navigation if they indicate
// that a navigation started at different times, so a new timing struct with a
@@ -333,6 +334,7 @@ bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing) {
timing_.navigation_start == new_timing.navigation_start;
if (IsValidPageLoadTiming(new_timing) && valid_timing_descendent) {
timing_ = new_timing;
+ metadata_ = new_metadata;
return true;
}
return false;
@@ -373,10 +375,10 @@ PageLoadExtraInfo PageLoadTracker::GetPageLoadMetricsInfo() {
} else {
DCHECK(commit_time_.is_null());
}
- return PageLoadExtraInfo(first_background_time, first_foreground_time,
- started_in_foreground_,
- commit_time_.is_null() ? GURL() : url_,
- time_to_commit, abort_type_, time_to_abort);
+ return PageLoadExtraInfo(
+ first_background_time, first_foreground_time, started_in_foreground_,
+ commit_time_.is_null() ? GURL() : url_, time_to_commit, abort_type_,
+ time_to_abort, metadata_);
}
void PageLoadTracker::NotifyAbort(UserAbortType abort_type,
@@ -678,7 +680,8 @@ MetricsWebContentsObserver::NotifyAbortedProvisionalLoadsNewNavigation(
void MetricsWebContentsObserver::OnTimingUpdated(
content::RenderFrameHost* render_frame_host,
- const PageLoadTiming& timing) {
+ const PageLoadTiming& timing,
+ const PageLoadMetadata& metadata) {
bool error = false;
if (!committed_load_ || !committed_load_->renderer_tracked()) {
RecordInternalError(ERR_IPC_WITH_NO_RELEVANT_LOAD);
@@ -703,7 +706,7 @@ void MetricsWebContentsObserver::OnTimingUpdated(
if (error)
return;
- if (!committed_load_->UpdateTiming(timing)) {
+ if (!committed_load_->UpdateTiming(timing, metadata)) {
// If the page load tracker cannot update its timing, something is wrong
// with the IPC (it's from another load, or it's invalid in some other way).
// We expect this to be a rare occurrence.

Powered by Google App Engine
This is Rietveld 408576698