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

Unified Diff: chrome/browser/metrics/first_web_contents_profiler.h

Issue 1407093003: Add start/finish navigation to startup metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2_better_ownership_model_firstwebcontentsprofiler
Patch Set: Using DidFinishNavigation() Created 5 years, 2 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/metrics/first_web_contents_profiler.h
diff --git a/chrome/browser/metrics/first_web_contents_profiler.h b/chrome/browser/metrics/first_web_contents_profiler.h
index 832d55539165642601e13c74422136012096a31a..9402f492608d48c1c1d40981f9d4421bafec1512 100644
--- a/chrome/browser/metrics/first_web_contents_profiler.h
+++ b/chrome/browser/metrics/first_web_contents_profiler.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
#define CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
+#include <set>
+
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "content/public/browser/web_contents_observer.h"
@@ -42,17 +44,23 @@ class FirstWebContentsProfiler : public content::WebContentsObserver {
};
explicit FirstWebContentsProfiler(content::WebContents* web_contents);
- ~FirstWebContentsProfiler() = default;
+ ~FirstWebContentsProfiler();
// content::WebContentsObserver:
void DidFirstVisuallyNonEmptyPaint() override;
void DocumentOnLoadCompletedInMainFrame() override;
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override;
+ void DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) override;
void NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) override;
void WasHidden() override;
void WebContentsDestroyed() override;
- // Whether this instance has finished collecting all of its metrics.
+ // Whether this instance has finished collecting first-paint and main-frame-
+ // load metrics (navigation metrics are recorded on a best effort but don't
+ // prevent the FirstWebContentsProfiler from calling it).
bool IsFinishedCollectingMetrics();
// Logs |finish_reason| to UMA and deletes this FirstWebContentsProfiler.
@@ -72,6 +80,20 @@ class FirstWebContentsProfiler : public content::WebContentsObserver {
// Whether an attempt was made to collect the "MainFrameLoad" metric.
bool collected_load_metric_;
+ // Whether an attempt was made to collect the "MainNavigationStart" metric.
+ bool collected_main_navigation_start_metric_;
+
+ // Whether an attempt was made to collect the "MainNavigationFinished" metric.
+ bool collected_main_navigation_finished_metric_;
+
+ // Whether an attempt was made to collect the "MainNavigationFinishedAll"
+ // metric.
+ bool collected_main_navigation_finished_all_metric_;
+
+ // The set of all live NavigationHandles for the main frame (i.e. handles seen
+ // by DidStartNavigation() but not by DidFinishNavigation()).
+ std::set<content::NavigationHandle*> main_navigation_handles_;
+
// Histogram that keeps track of response times for the watched thread.
base::HistogramBase* responsiveness_histogram_;

Powered by Google App Engine
This is Rietveld 408576698