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

Side by Side 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: rebase on trunk Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_ 5 #ifndef CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
6 #define CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_ 6 #define CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
(...skipping 28 matching lines...) Expand all
39 enum FinishReason { 39 enum FinishReason {
40 // All metrics were successfully gathered. 40 // All metrics were successfully gathered.
41 DONE = 0, 41 DONE = 0,
42 // Abandon if blocking UI was shown during startup. 42 // Abandon if blocking UI was shown during startup.
43 ABANDON_BLOCKING_UI = 1, 43 ABANDON_BLOCKING_UI = 1,
44 // Abandon if the content is hidden (lowers scheduling priority). 44 // Abandon if the content is hidden (lowers scheduling priority).
45 ABANDON_CONTENT_HIDDEN = 2, 45 ABANDON_CONTENT_HIDDEN = 2,
46 // Abandon if the content is destroyed. 46 // Abandon if the content is destroyed.
47 ABANDON_CONTENT_DESTROYED = 3, 47 ABANDON_CONTENT_DESTROYED = 3,
48 // Abandon if the WebContents navigates away from its initial page. 48 // Abandon if the WebContents navigates away from its initial page.
49 ABANDON_NAVIGATION = 4, 49 ABANDON_NEW_NAVIGATION = 4,
50 // Abandon if the WebContents fails to load (e.g. network error, etc.).
51 ABANDON_NAVIGATION_ERROR = 5,
50 ENUM_MAX 52 ENUM_MAX
51 }; 53 };
52 54
53 FirstWebContentsProfiler(content::WebContents* web_contents, 55 FirstWebContentsProfiler(content::WebContents* web_contents,
54 Delegate* delegate); 56 Delegate* delegate);
55 57
56 // content::WebContentsObserver: 58 // content::WebContentsObserver:
57 void DidFirstVisuallyNonEmptyPaint() override; 59 void DidFirstVisuallyNonEmptyPaint() override;
58 void DocumentOnLoadCompletedInMainFrame() override; 60 void DocumentOnLoadCompletedInMainFrame() override;
61 void DidStartNavigation(
62 content::NavigationHandle* navigation_handle) override;
63 void DidFinishNavigation(
64 content::NavigationHandle* navigation_handle) override;
59 void NavigationEntryCommitted( 65 void NavigationEntryCommitted(
60 const content::LoadCommittedDetails& load_details) override; 66 const content::LoadCommittedDetails& load_details) override;
61 void WasHidden() override; 67 void WasHidden() override;
62 void WebContentsDestroyed() override; 68 void WebContentsDestroyed() override;
63 69
64 // Whether this instance has finished collecting all of its metrics. 70 // Whether this instance has finished collecting first-paint and main-frame-
71 // load metrics (navigation metrics are recorded on a best effort but don't
72 // prevent the FirstWebContentsProfiler from calling it).
65 bool IsFinishedCollectingMetrics(); 73 bool IsFinishedCollectingMetrics();
66 74
67 // Informs the delegate that this instance has finished collecting all of its 75 // Informs the delegate that this instance has finished collecting all of its
68 // metrics. Logs |finish_reason| to UMA. 76 // metrics. Logs |finish_reason| to UMA.
69 void FinishedCollectingMetrics(FinishReason finish_reason); 77 void FinishedCollectingMetrics(FinishReason finish_reason);
70 78
71 // Initialize histograms for unresponsiveness metrics. 79 // Initialize histograms for unresponsiveness metrics.
72 void InitHistograms(); 80 void InitHistograms();
73 81
74 // Becomes true on the first invocation of NavigationEntryCommitted() for the 82 // Becomes true on the first invocation of NavigationEntryCommitted() for the
75 // main frame. Any follow-up navigation to a different page will result in 83 // main frame. Any follow-up navigation to a different page will result in
76 // aborting first WebContents profiling. 84 // aborting first WebContents profiling.
77 bool initial_entry_committed_; 85 bool initial_entry_committed_;
78 86
79 // Whether an attempt was made to collect the "NonEmptyPaint" metric. 87 // Whether an attempt was made to collect the "NonEmptyPaint" metric.
80 bool collected_paint_metric_; 88 bool collected_paint_metric_;
81 89
82 // Whether an attempt was made to collect the "MainFrameLoad" metric. 90 // Whether an attempt was made to collect the "MainFrameLoad" metric.
83 bool collected_load_metric_; 91 bool collected_load_metric_;
84 92
93 // Whether an attempt was made to collect the "MainNavigationStart" metric.
94 bool collected_main_navigation_start_metric_;
95
96 // Whether an attempt was made to collect the "MainNavigationFinished" metric.
97 bool collected_main_navigation_finished_metric_;
98
85 // |delegate_| owns |this|. 99 // |delegate_| owns |this|.
86 Delegate* delegate_; 100 Delegate* delegate_;
87 101
88 // Histogram that keeps track of response times for the watched thread. 102 // Histogram that keeps track of response times for the watched thread.
89 base::HistogramBase* responsiveness_histogram_; 103 base::HistogramBase* responsiveness_histogram_;
90 104
91 // Histogram that keeps track of response times for the watched thread. 105 // Histogram that keeps track of response times for the watched thread.
92 base::HistogramBase* responsiveness_1sec_histogram_; 106 base::HistogramBase* responsiveness_1sec_histogram_;
93 107
94 // Histogram that keeps track of response times for the watched thread. 108 // Histogram that keeps track of response times for the watched thread.
95 base::HistogramBase* responsiveness_10sec_histogram_; 109 base::HistogramBase* responsiveness_10sec_histogram_;
96 110
97 // Histogram that keeps track of response times for the watched thread. 111 // Histogram that keeps track of response times for the watched thread.
98 base::HistogramBase* unresponsiveness_histogram_; 112 base::HistogramBase* unresponsiveness_histogram_;
99 113
100 // Histogram that keeps track of response times for the watched thread. 114 // Histogram that keeps track of response times for the watched thread.
101 base::HistogramBase* unresponsiveness_1sec_histogram_; 115 base::HistogramBase* unresponsiveness_1sec_histogram_;
102 116
103 // Histogram that keeps track of response times for the watched thread. 117 // Histogram that keeps track of response times for the watched thread.
104 base::HistogramBase* unresponsiveness_10sec_histogram_; 118 base::HistogramBase* unresponsiveness_10sec_histogram_;
105 119
106 DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler); 120 DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler);
107 }; 121 };
108 122
109 #endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_ 123 #endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698