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

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

Issue 2737563007: Add support for tracking loading behavior of child frames. (Closed)
Patch Set: improve test comments Created 3 years, 9 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 ba63fd9f6e830ed1cfb9d68dbd1a4b91c6e8bf65..0f669d9ff2d2ddbe1cccebd10d7134cdba4e4f2a 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -512,7 +512,9 @@ void MetricsWebContentsObserver::OnTimingUpdated(
const PageLoadMetadata& metadata) {
// We may receive notifications from frames that have been navigated away
// from. We simply ignore them.
- if (render_frame_host != web_contents()->GetMainFrame()) {
+ if (!render_frame_host->GetRenderViewHost() ||
Charlie Harrison 2017/03/09 16:21:28 Is it possible to have a null RVH here?
Bryan McQuade 2017/03/09 17:36:32 it's a good question. i don't know for sure. i can
+ render_frame_host->GetRenderViewHost()->GetMainFrame() !=
+ web_contents()->GetMainFrame()) {
RecordInternalError(ERR_IPC_FROM_WRONG_FRAME);
return;
}
@@ -535,6 +537,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_->UpdateChildMetadata(metadata);
+ return;
+ }
+
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).

Powered by Google App Engine
This is Rietveld 408576698