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

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

Issue 2823523003: [Page Load Metrics] PageLoadMetrics Mojofication. (Closed)
Patch Set: Addressed comments, remove unnecessary RunUntilIdle, call OnTimingUpdated directly in unit tests 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
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 0d15216c24b23715201435999c527e6b5e2e46ba..54cfa044d80b4ff1d27859c014f8f40cc557c869 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -64,17 +64,18 @@ UserInitiatedInfo CreateUserInitiatedInfo(
} // namespace
-// static
MetricsWebContentsObserver::MetricsWebContentsObserver(
content::WebContents* web_contents,
std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface)
: content::WebContentsObserver(web_contents),
in_foreground_(false),
embedder_interface_(std::move(embedder_interface)),
- has_navigated_(false) {
+ has_navigated_(false),
+ page_load_metrics_binding_(web_contents, this) {
RegisterInputEventObserver(web_contents->GetRenderViewHost());
}
+// static
MetricsWebContentsObserver* MetricsWebContentsObserver::CreateForWebContents(
content::WebContents* web_contents,
std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface) {
@@ -599,6 +600,14 @@ void MetricsWebContentsObserver::OnTimingUpdated(
committed_load_->UpdateTiming(timing, metadata);
}
+void MetricsWebContentsObserver::UpdateTiming(
+ const PageLoadTiming& timing,
+ const PageLoadMetadata& metadata) {
+ content::RenderFrameHost* render_frame_host =
+ page_load_metrics_binding_.GetCurrentTargetFrame();
+ OnTimingUpdated(render_frame_host, timing, metadata);
+}
+
bool MetricsWebContentsObserver::ShouldTrackNavigation(
content::NavigationHandle* navigation_handle) const {
DCHECK(navigation_handle->IsInMainFrame());

Powered by Google App Engine
This is Rietveld 408576698