| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ | 5 #ifndef CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ |
| 6 #define CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ | 6 #define CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 11 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
| 12 #include "chrome/browser/metrics/first_web_contents_profiler.h" |
| 12 #include "ui/gfx/display_observer.h" | 13 #include "ui/gfx/display_observer.h" |
| 13 | 14 |
| 14 class ChromeBrowserMainParts; | 15 class ChromeBrowserMainParts; |
| 15 | 16 |
| 16 namespace chrome { | 17 namespace chrome { |
| 17 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts); | 18 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts); |
| 18 } | 19 } |
| 19 | 20 |
| 20 class ChromeBrowserMainExtraPartsMetrics : public ChromeBrowserMainExtraParts, | 21 class ChromeBrowserMainExtraPartsMetrics |
| 21 public gfx::DisplayObserver { | 22 : public ChromeBrowserMainExtraParts, |
| 23 public gfx::DisplayObserver, |
| 24 public FirstWebContentsProfiler::Delegate { |
| 22 public: | 25 public: |
| 23 ChromeBrowserMainExtraPartsMetrics(); | 26 ChromeBrowserMainExtraPartsMetrics(); |
| 24 ~ChromeBrowserMainExtraPartsMetrics() override; | 27 ~ChromeBrowserMainExtraPartsMetrics() override; |
| 25 | 28 |
| 26 // Overridden from ChromeBrowserMainExtraParts: | 29 // Overridden from ChromeBrowserMainExtraParts: |
| 27 void PreProfileInit() override; | 30 void PreProfileInit() override; |
| 28 void PreBrowserStart() override; | 31 void PreBrowserStart() override; |
| 29 void PostBrowserStart() override; | 32 void PostBrowserStart() override; |
| 30 | 33 |
| 31 private: | 34 private: |
| 32 #if defined(OS_MACOSX) && !defined(OS_IOS) | 35 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 33 // Records Mac specific metrics. | 36 // Records Mac specific metrics. |
| 34 void RecordMacMetrics(); | 37 void RecordMacMetrics(); |
| 35 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 38 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 36 | 39 |
| 37 // DisplayObserver overrides. | 40 // DisplayObserver overrides. |
| 38 virtual void OnDisplayAdded(const gfx::Display& new_display) override; | 41 virtual void OnDisplayAdded(const gfx::Display& new_display) override; |
| 39 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; | 42 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; |
| 40 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 43 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
| 41 uint32_t changed_metrics) override; | 44 uint32_t changed_metrics) override; |
| 42 | 45 |
| 46 // FirstWebContentsProfilerDelegate overrides. |
| 47 void ProfilerFinishedCollectingMetrics() override; |
| 48 |
| 43 // If the number of displays has changed, emit a UMA metric. | 49 // If the number of displays has changed, emit a UMA metric. |
| 44 void EmitDisplaysChangedMetric(); | 50 void EmitDisplaysChangedMetric(); |
| 45 | 51 |
| 46 // A cached value for the number of displays. | 52 // A cached value for the number of displays. |
| 47 int display_count_; | 53 int display_count_; |
| 48 | 54 |
| 49 // True iff |this| instance is registered as an observer of the native | 55 // True iff |this| instance is registered as an observer of the native |
| 50 // screen. | 56 // screen. |
| 51 bool is_screen_observer_; | 57 bool is_screen_observer_; |
| 52 | 58 |
| 59 // Measures start up performance of the first active web contents. |
| 60 scoped_ptr<FirstWebContentsProfiler> first_web_contents_profiler_; |
| 61 |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetrics); | 62 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetrics); |
| 54 }; | 63 }; |
| 55 | 64 |
| 56 #endif // CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ | 65 #endif // CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ |
| OLD | NEW |