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

Unified Diff: chrome/renderer/page_load_metrics/metrics_render_frame_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/renderer/page_load_metrics/metrics_render_frame_observer.cc
diff --git a/chrome/renderer/page_load_metrics/metrics_render_frame_observer.cc b/chrome/renderer/page_load_metrics/metrics_render_frame_observer.cc
index 059653cbaf9ebc27469efbaf6d40328aa3d5bb12..8622bae774639a59fe6067bd11afe646d3eca495 100644
--- a/chrome/renderer/page_load_metrics/metrics_render_frame_observer.cc
+++ b/chrome/renderer/page_load_metrics/metrics_render_frame_observer.cc
@@ -12,6 +12,7 @@
#include "chrome/renderer/page_load_metrics/page_timing_metrics_sender.h"
#include "chrome/renderer/page_load_metrics/renderer_page_track_decider.h"
#include "chrome/renderer/searchbox/search_bouncer.h"
+#include "content/public/common/associated_interface_provider.h"
#include "content/public/renderer/render_frame.h"
#include "third_party/WebKit/public/web/WebDataSource.h"
#include "third_party/WebKit/public/web/WebDocument.h"
@@ -37,6 +38,17 @@ MetricsRenderFrameObserver::MetricsRenderFrameObserver(
MetricsRenderFrameObserver::~MetricsRenderFrameObserver() {}
+void MetricsRenderFrameObserver::SendTiming(const PageLoadTiming& timing,
+ const PageLoadMetadata& metadata) {
+ if (HasNoRenderFrame())
+ return;
+ if (!page_load_metrics_) {
+ render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(
+ &page_load_metrics_);
+ }
+ page_load_metrics_->UpdateTiming(timing, metadata);
Zhen Wang 2017/04/19 18:49:54 Why should MetricsRenderFrameObserver care about s
lpy 2017/04/19 21:05:05 MetricsRenderFrameObserver is IPC::Sender, PageTim
Zhen Wang 2017/04/19 21:52:47 Oh, I see.
+}
+
void MetricsRenderFrameObserver::DidChangePerformanceTiming() {
// Only track timing metrics for main frames.
if (IsMainFrame())
@@ -78,8 +90,8 @@ void MetricsRenderFrameObserver::DidCommitProvisionalLoad(
timing = GetTiming();
DCHECK(!timing.navigation_start.is_null());
}
- page_timing_metrics_sender_.reset(
- new PageTimingMetricsSender(this, routing_id(), CreateTimer(), timing));
+ page_timing_metrics_sender_.reset(new PageTimingMetricsSender(
+ this, routing_id(), this, CreateTimer(), timing));
}
}

Powered by Google App Engine
This is Rietveld 408576698