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

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: review:clamy => simpler == better :-) 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 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 19 matching lines...) Expand all
30 enum FinishReason { 30 enum FinishReason {
31 // All metrics were successfully gathered. 31 // All metrics were successfully gathered.
32 DONE = 0, 32 DONE = 0,
33 // Abandon if blocking UI was shown during startup. 33 // Abandon if blocking UI was shown during startup.
34 ABANDON_BLOCKING_UI = 1, 34 ABANDON_BLOCKING_UI = 1,
35 // Abandon if the content is hidden (lowers scheduling priority). 35 // Abandon if the content is hidden (lowers scheduling priority).
36 ABANDON_CONTENT_HIDDEN = 2, 36 ABANDON_CONTENT_HIDDEN = 2,
37 // Abandon if the content is destroyed. 37 // Abandon if the content is destroyed.
38 ABANDON_CONTENT_DESTROYED = 3, 38 ABANDON_CONTENT_DESTROYED = 3,
39 // Abandon if the WebContents navigates away from its initial page. 39 // Abandon if the WebContents navigates away from its initial page.
40 ABANDON_NAVIGATION = 4, 40 ABANDON_NEW_NAVIGATION = 4,
41 // Abandon if the WebContents fails to load (e.g. network error, etc.).
42 ABANDON_NAVIGATION_ERROR = 5,
41 ENUM_MAX 43 ENUM_MAX
42 }; 44 };
43 45
44 explicit FirstWebContentsProfiler(content::WebContents* web_contents); 46 explicit FirstWebContentsProfiler(content::WebContents* web_contents);
45 ~FirstWebContentsProfiler() = default; 47 ~FirstWebContentsProfiler() = default;
46 48
47 // content::WebContentsObserver: 49 // content::WebContentsObserver:
48 void DidFirstVisuallyNonEmptyPaint() override; 50 void DidFirstVisuallyNonEmptyPaint() override;
49 void DocumentOnLoadCompletedInMainFrame() override; 51 void DocumentOnLoadCompletedInMainFrame() override;
52 void DidStartNavigation(
53 content::NavigationHandle* navigation_handle) override;
54 void DidFinishNavigation(
55 content::NavigationHandle* navigation_handle) override;
50 void NavigationEntryCommitted( 56 void NavigationEntryCommitted(
51 const content::LoadCommittedDetails& load_details) override; 57 const content::LoadCommittedDetails& load_details) override;
52 void WasHidden() override; 58 void WasHidden() override;
53 void WebContentsDestroyed() override; 59 void WebContentsDestroyed() override;
54 60
55 // Whether this instance has finished collecting all of its metrics. 61 // Whether this instance has finished collecting first-paint and main-frame-
62 // load metrics (navigation metrics are recorded on a best effort but don't
63 // prevent the FirstWebContentsProfiler from calling it).
56 bool IsFinishedCollectingMetrics(); 64 bool IsFinishedCollectingMetrics();
57 65
58 // Logs |finish_reason| to UMA and deletes this FirstWebContentsProfiler. 66 // Logs |finish_reason| to UMA and deletes this FirstWebContentsProfiler.
59 void FinishedCollectingMetrics(FinishReason finish_reason); 67 void FinishedCollectingMetrics(FinishReason finish_reason);
60 68
61 // Initialize histograms for unresponsiveness metrics. 69 // Initialize histograms for unresponsiveness metrics.
62 void InitHistograms(); 70 void InitHistograms();
63 71
64 // Becomes true on the first invocation of NavigationEntryCommitted() for the 72 // Becomes true on the first invocation of NavigationEntryCommitted() for the
65 // main frame. Any follow-up navigation to a different page will result in 73 // main frame. Any follow-up navigation to a different page will result in
66 // aborting first WebContents profiling. 74 // aborting first WebContents profiling.
67 bool initial_entry_committed_; 75 bool initial_entry_committed_;
68 76
69 // Whether an attempt was made to collect the "NonEmptyPaint" metric. 77 // Whether an attempt was made to collect the "NonEmptyPaint" metric.
70 bool collected_paint_metric_; 78 bool collected_paint_metric_;
71 79
72 // Whether an attempt was made to collect the "MainFrameLoad" metric. 80 // Whether an attempt was made to collect the "MainFrameLoad" metric.
73 bool collected_load_metric_; 81 bool collected_load_metric_;
74 82
83 // Whether an attempt was made to collect the "MainNavigationStart" metric.
84 bool collected_main_navigation_start_metric_;
85
86 // Whether an attempt was made to collect the "MainNavigationFinished" metric.
87 bool collected_main_navigation_finished_metric_;
88
75 // Histogram that keeps track of response times for the watched thread. 89 // Histogram that keeps track of response times for the watched thread.
76 base::HistogramBase* responsiveness_histogram_; 90 base::HistogramBase* responsiveness_histogram_;
77 91
78 // Histogram that keeps track of response times for the watched thread. 92 // Histogram that keeps track of response times for the watched thread.
79 base::HistogramBase* responsiveness_1sec_histogram_; 93 base::HistogramBase* responsiveness_1sec_histogram_;
80 94
81 // Histogram that keeps track of response times for the watched thread. 95 // Histogram that keeps track of response times for the watched thread.
82 base::HistogramBase* responsiveness_10sec_histogram_; 96 base::HistogramBase* responsiveness_10sec_histogram_;
83 97
84 // Histogram that keeps track of response times for the watched thread. 98 // Histogram that keeps track of response times for the watched thread.
85 base::HistogramBase* unresponsiveness_histogram_; 99 base::HistogramBase* unresponsiveness_histogram_;
86 100
87 // Histogram that keeps track of response times for the watched thread. 101 // Histogram that keeps track of response times for the watched thread.
88 base::HistogramBase* unresponsiveness_1sec_histogram_; 102 base::HistogramBase* unresponsiveness_1sec_histogram_;
89 103
90 // Histogram that keeps track of response times for the watched thread. 104 // Histogram that keeps track of response times for the watched thread.
91 base::HistogramBase* unresponsiveness_10sec_histogram_; 105 base::HistogramBase* unresponsiveness_10sec_histogram_;
92 106
93 DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler); 107 DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler);
94 }; 108 };
95 109
96 #endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_ 110 #endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698