Chromium Code Reviews| 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). |