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

Unified Diff: chrome/renderer/page_load_metrics/metrics_render_frame_observer.h

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/renderer/page_load_metrics/metrics_render_frame_observer.h
diff --git a/chrome/renderer/page_load_metrics/metrics_render_frame_observer.h b/chrome/renderer/page_load_metrics/metrics_render_frame_observer.h
index 3b9ad1e915cf3a676e7ba8a0557378eea7038a91..94a91121607fa411cdb9e54972752013a2ebb41d 100644
--- a/chrome/renderer/page_load_metrics/metrics_render_frame_observer.h
+++ b/chrome/renderer/page_load_metrics/metrics_render_frame_observer.h
@@ -8,7 +8,9 @@
#include <memory>
#include "base/macros.h"
+#include "chrome/common/page_load_metrics/page_load_metrics.mojom.h"
#include "chrome/common/page_load_metrics/page_load_timing.h"
+#include "chrome/renderer/page_load_metrics/page_timing_sender.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
@@ -25,11 +27,16 @@ class PageTimingMetricsSender;
// MetricsRenderFrameObserver is instantiated for each frame (main frames and
// child frames). MetricsRenderFrameObserver dispatches timing and metadata
// updates for main frames, but only metadata updates for child frames.
-class MetricsRenderFrameObserver : public content::RenderFrameObserver {
+class MetricsRenderFrameObserver : public content::RenderFrameObserver,
+ public PageTimingSender {
public:
explicit MetricsRenderFrameObserver(content::RenderFrame* render_frame);
~MetricsRenderFrameObserver() override;
+ // PageTimingSender implementation
+ void SendTiming(const PageLoadTiming& timing,
+ const PageLoadMetadata& metadata) override;
+
// RenderFrameObserver implementation
void DidChangePerformanceTiming() override;
void DidObserveLoadingBehavior(
@@ -43,9 +50,6 @@ class MetricsRenderFrameObserver : public content::RenderFrameObserver {
void FrameDetached() override;
private:
- // Will be null when we're not actively sending metrics.
- std::unique_ptr<PageTimingMetricsSender> page_timing_metrics_sender_;
-
void SendMetrics();
virtual bool ShouldSendMetrics() const;
virtual PageLoadTiming GetTiming() const;
@@ -53,6 +57,10 @@ class MetricsRenderFrameObserver : public content::RenderFrameObserver {
virtual bool HasNoRenderFrame() const;
virtual bool IsMainFrame() const;
+ // Will be null when we're not actively sending metrics.
+ std::unique_ptr<PageTimingMetricsSender> page_timing_metrics_sender_;
+ mojom::PageLoadMetricsAssociatedPtr page_load_metrics_;
Bryan McQuade 2017/04/26 16:04:34 Let's add a short comment explaining why we use a
lpy 2017/04/27 10:58:35 Done. They are two different concepts. A plain Pa
+
DISALLOW_COPY_AND_ASSIGN(MetricsRenderFrameObserver);
};

Powered by Google App Engine
This is Rietveld 408576698