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)); |
} |
} |