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

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: add comment 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..e6b9ebdee27b2e2d518178ad6cd35d8a8d920d56 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -39,16 +39,6 @@ namespace page_load_metrics {
namespace {
-content::RenderFrameHost* GetMainFrame(content::RenderFrameHost* rfh) {
- // Don't use rfh->GetRenderViewHost()->GetMainFrame() here because
- // RenderViewHost is being deprecated and because in OOPIF,
- // RenderViewHost::GetMainFrame() returns nullptr for child frames hosted in a
- // different process from the main frame.
- while (rfh->GetParent() != nullptr)
- rfh = rfh->GetParent();
- return rfh;
-}
-
UserInitiatedInfo CreateUserInitiatedInfo(
content::NavigationHandle* navigation_handle,
PageLoadTracker* committed_load) {
@@ -595,19 +585,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