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

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

Issue 1312213010: PageLoadMetrics renderer and browser implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Relax DCHECK constraints slightly for tests Created 5 years, 3 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: components/page_load_metrics/renderer/metrics_render_frame_observer.h
diff --git a/components/page_load_metrics/renderer/metrics_render_frame_observer.h b/components/page_load_metrics/renderer/metrics_render_frame_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..975d89c994732f6aa992a28a6e4c996bfa193931
--- /dev/null
+++ b/components/page_load_metrics/renderer/metrics_render_frame_observer.h
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBSERVER_H_
+#define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBSERVER_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/page_load_metrics/common/page_load_timing.h"
+#include "content/public/renderer/render_frame_observer.h"
+
+namespace base {
+class Timer;
+} // namespace base
+
+namespace page_load_metrics {
+
+class PageTimingMetricsSender;
+
+// MetricsRenderFrameObserver observes RenderFrame notifications, and
+// sends page load timing information to the browser process over IPC.
+class MetricsRenderFrameObserver : public content::RenderFrameObserver {
+ public:
+ explicit MetricsRenderFrameObserver(content::RenderFrame* render_frame);
+ ~MetricsRenderFrameObserver() override;
+
+ // RenderFrameObserver implementation
+ void DidChangePerformanceTiming() override;
+ void DidCommitProvisionalLoad(bool is_new_navigation,
+ bool is_same_page_navigation) override;
+
+ private:
+ // Will be null when we're not actively sending metrics.
+ scoped_ptr<PageTimingMetricsSender> page_timing_metrics_sender_;
+
+ void SendMetrics();
+ virtual bool ShouldSendMetrics() const;
+ virtual PageLoadTiming GetTiming() const;
+ virtual scoped_ptr<base::Timer> CreateTimer() const;
+
+ DISALLOW_COPY_AND_ASSIGN(MetricsRenderFrameObserver);
+};
+
+} // namespace page_load_metrics
+
+#endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_LOAD_METRICS_RENDER_FRAME_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698