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

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

Issue 2823523003: [Page Load Metrics] PageLoadMetrics Mojofication. (Closed)
Patch Set: Add Finch trial check and rebase 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 a58984656eec1b8effd05e16e67ee570f0d744ab..f3b298d0f73d7988d6e737885322e0fc81075b4d 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) {
@@ -580,6 +581,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);
Zhen Wang 2017/04/19 18:49:54 This is using the same timing update function as t
Zhen Wang 2017/04/19 18:56:31 I just realized that you may not need to do any sp
+}
+
bool MetricsWebContentsObserver::ShouldTrackNavigation(
content::NavigationHandle* navigation_handle) const {
DCHECK(navigation_handle->IsInMainFrame());

Powered by Google App Engine
This is Rietveld 408576698