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

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

Issue 2795283003: Simplify MetricsWebContentsObserver::OnTimingUpdated (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e3f51bf4946a1b2cc9437a0e973f4b77a78e5325..5d59ba4efb20d98dee6b7f252aa3806e3fb9cdda 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -525,11 +525,18 @@ void MetricsWebContentsObserver::OnTimingUpdated(
content::RenderFrameHost* render_frame_host,
const PageLoadTiming& timing,
const PageLoadMetadata& metadata) {
+ if (render_frame_host->GetParent() != nullptr) {
nasko 2017/04/04 22:18:14 Dumping just a bit of context from chat with cshar
Bryan McQuade 2017/04/06 18:46:33 Thanks for this. It's helpful to know. I'm assumi
+ // Child frames may send PageLoadMetadata updates, but not PageLoadTiming
+ // updates.
+ if (!timing.IsEmpty())
+ RecordInternalError(ERR_TIMING_IPC_FROM_SUBFRAME);
+ committed_load_->UpdateChildFrameMetadata(metadata);
+ return;
+ }
+
// We may receive notifications from frames that have been navigated away
// from. We simply ignore them.
- if (!render_frame_host->GetRenderViewHost() ||
- render_frame_host->GetRenderViewHost()->GetMainFrame() !=
- web_contents()->GetMainFrame()) {
+ if (render_frame_host != web_contents()->GetMainFrame()) {
RecordInternalError(ERR_IPC_FROM_WRONG_FRAME);
return;
}
@@ -552,15 +559,6 @@ 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;
- }
-
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).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698