| OLD | NEW |
| 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" | |
| 10 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 11 | 10 |
| 12 namespace content { | 11 namespace content { |
| 13 class WebContents; | 12 class WebContents; |
| 14 } // namespace content | 13 } // namespace content |
| 15 | 14 |
| 16 // Measures start up performance of the first active web contents. | 15 // Measures start up performance of the first active web contents. |
| 17 // This class is declared on all platforms, but only defined on non-Android | 16 // This class is declared on all platforms, but only defined on non-Android |
| 18 // platforms. Android code should not call any non-trivial methods on this | 17 // platforms. Android code should not call any non-trivial methods on this |
| 19 // class. | 18 // class. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 66 |
| 68 // Whether this instance has finished collecting first-paint and main-frame- | 67 // Whether this instance has finished collecting first-paint and main-frame- |
| 69 // load metrics (navigation metrics are recorded on a best effort but don't | 68 // load metrics (navigation metrics are recorded on a best effort but don't |
| 70 // prevent the FirstWebContentsProfiler from calling it). | 69 // prevent the FirstWebContentsProfiler from calling it). |
| 71 bool IsFinishedCollectingMetrics(); | 70 bool IsFinishedCollectingMetrics(); |
| 72 | 71 |
| 73 // Informs the delegate that this instance has finished collecting all of its | 72 // Informs the delegate that this instance has finished collecting all of its |
| 74 // metrics. Logs |finish_reason| to UMA. | 73 // metrics. Logs |finish_reason| to UMA. |
| 75 void FinishedCollectingMetrics(FinishReason finish_reason); | 74 void FinishedCollectingMetrics(FinishReason finish_reason); |
| 76 | 75 |
| 77 // Initialize histograms for unresponsiveness metrics. | |
| 78 void InitHistograms(); | |
| 79 | |
| 80 // Whether an attempt was made to collect the "NonEmptyPaint" metric. | 76 // Whether an attempt was made to collect the "NonEmptyPaint" metric. |
| 81 bool collected_paint_metric_; | 77 bool collected_paint_metric_; |
| 82 | 78 |
| 83 // Whether an attempt was made to collect the "MainFrameLoad" metric. | 79 // Whether an attempt was made to collect the "MainFrameLoad" metric. |
| 84 bool collected_load_metric_; | 80 bool collected_load_metric_; |
| 85 | 81 |
| 86 // Whether an attempt was made to collect the "MainNavigationStart" metric. | 82 // Whether an attempt was made to collect the "MainNavigationStart" metric. |
| 87 bool collected_main_navigation_start_metric_; | 83 bool collected_main_navigation_start_metric_; |
| 88 | 84 |
| 89 // Whether an attempt was made to collect the "MainNavigationFinished" metric. | 85 // Whether an attempt was made to collect the "MainNavigationFinished" metric. |
| 90 bool collected_main_navigation_finished_metric_; | 86 bool collected_main_navigation_finished_metric_; |
| 91 | 87 |
| 92 // Whether core metric collection is complete. Used to keep reporting old | 88 // Whether core metric collection is complete. Used to keep reporting old |
| 93 // stats post abandon to give us an intra-milestone comparison basis initially | 89 // stats post abandon to give us an intra-milestone comparison basis initially |
| 94 // between the old and new stats. TODO(gab): Remove this in M49. | 90 // between the old and new stats. TODO(gab): Remove this in M49. |
| 95 bool finished_; | 91 bool finished_; |
| 96 | 92 |
| 97 // |delegate_| owns |this|. | 93 // |delegate_| owns |this|. |
| 98 Delegate* delegate_; | 94 Delegate* delegate_; |
| 99 | 95 |
| 100 // Histogram that keeps track of response times for the watched thread. | |
| 101 base::HistogramBase* responsiveness_histogram_; | |
| 102 | |
| 103 // Histogram that keeps track of response times for the watched thread. | |
| 104 base::HistogramBase* responsiveness_1sec_histogram_; | |
| 105 | |
| 106 // Histogram that keeps track of response times for the watched thread. | |
| 107 base::HistogramBase* responsiveness_10sec_histogram_; | |
| 108 | |
| 109 // Histogram that keeps track of response times for the watched thread. | |
| 110 base::HistogramBase* unresponsiveness_histogram_; | |
| 111 | |
| 112 // Histogram that keeps track of response times for the watched thread. | |
| 113 base::HistogramBase* unresponsiveness_1sec_histogram_; | |
| 114 | |
| 115 // Histogram that keeps track of response times for the watched thread. | |
| 116 base::HistogramBase* unresponsiveness_10sec_histogram_; | |
| 117 | |
| 118 DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler); | 96 DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler); |
| 119 }; | 97 }; |
| 120 | 98 |
| 121 #endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_ | 99 #endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_ |
| OLD | NEW |