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

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

Issue 2859393002: Report page load timing information for child frames. (Closed)
Patch Set: cleanup Created 3 years, 7 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: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
index 044495e8c15477c6feb9d26f3b8e58b564fdebe0..46267aed8ef97684290442c4a30f67856ce29e5f 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -313,6 +313,11 @@ MetricsWebContentsObserver::GetPageLoadExtraInfoForCommittedLoad() {
void MetricsWebContentsObserver::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
+ if (GetMainFrame(navigation_handle->GetRenderFrameHost()) !=
jkarlin 2017/05/08 13:00:41 I *think* that GetRFH will dcheck if the navigatio
Bryan McQuade 2017/05/08 15:26:31 ah, good catch, thanks! I moved this check into th
+ web_contents()->GetMainFrame()) {
+ // Ignore navigations for a main frame that was navigated away from.
+ return;
+ }
if (!navigation_handle->IsInMainFrame() && committed_load_) {
committed_load_->DidFinishSubFrameNavigation(navigation_handle);
return;
@@ -595,19 +600,15 @@ void MetricsWebContentsObserver::OnTimingUpdated(
if (error)
return;
- if (render_frame_host->GetParent() != nullptr) {
- // Child frames may send PageLoadMetadata updates, but not PageLoadTiming
- // updates.
- if (!timing.IsEmpty())
- RecordInternalError(ERR_TIMING_IPC_FROM_SUBFRAME);
- committed_load_->UpdateChildFrameMetadata(metadata);
- return;
+ const bool is_main_frame = (render_frame_host->GetParent() == nullptr);
+ if (is_main_frame) {
+ committed_load_->UpdateTiming(timing, metadata);
+ } else {
+ committed_load_->UpdateSubFrameTiming(render_frame_host, timing, metadata);
}
- committed_load_->UpdateTiming(timing, metadata);
-
for (auto& observer : testing_observers_)
- observer.OnTimingUpdated(timing, metadata);
+ observer.OnTimingUpdated(is_main_frame, timing, metadata);
}
bool MetricsWebContentsObserver::ShouldTrackNavigation(

Powered by Google App Engine
This is Rietveld 408576698