| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_STABILITY_METRICS_PROVIDER_H_ | 5 #ifndef BLIMP_ENGINE_APP_BLIMP_STABILITY_METRICS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ | 6 #define BLIMP_ENGINE_APP_BLIMP_STABILITY_METRICS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
| 11 #include "base/process/kill.h" | 11 #include "base/process/kill.h" |
| 12 #include "components/metrics/metrics_provider.h" | 12 #include "components/metrics/metrics_provider.h" |
| 13 #include "components/metrics/stability_metrics_helper.h" | 13 #include "components/metrics/stability_metrics_helper.h" |
| 14 #include "content/public/browser/browser_child_process_observer.h" | 14 #include "content/public/browser/browser_child_process_observer.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 | 17 |
| 18 class PrefService; | 18 class PrefService; |
| 19 | 19 |
| 20 // ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability- | 20 // BlimpStabilityMetricsProvider gathers and logs Blimp-specific stability- |
| 21 // related metrics. | 21 // related metrics. |
| 22 class ChromeStabilityMetricsProvider | 22 class BlimpStabilityMetricsProvider |
| 23 : public metrics::MetricsProvider, | 23 : public metrics::MetricsProvider, |
| 24 public content::BrowserChildProcessObserver, | 24 public content::BrowserChildProcessObserver, |
| 25 public content::NotificationObserver { | 25 public content::NotificationObserver { |
| 26 public: | 26 public: |
| 27 explicit ChromeStabilityMetricsProvider(PrefService* local_state); | 27 explicit BlimpStabilityMetricsProvider(PrefService* local_state); |
| 28 ~ChromeStabilityMetricsProvider() override; | 28 ~BlimpStabilityMetricsProvider() override; |
| 29 | 29 |
| 30 // metrics::MetricsDataProvider: | 30 // metrics::MetricsDataProvider: |
| 31 void OnRecordingEnabled() override; | 31 void OnRecordingEnabled() override; |
| 32 void OnRecordingDisabled() override; | 32 void OnRecordingDisabled() override; |
| 33 void ProvideStabilityMetrics( | 33 void ProvideStabilityMetrics( |
| 34 metrics::SystemProfileProto* system_profile_proto) override; | 34 metrics::SystemProfileProto* system_profile_proto) override; |
| 35 void ClearSavedStabilityMetrics() override; | 35 void ClearSavedStabilityMetrics() override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 FRIEND_TEST_ALL_PREFIXES(ChromeStabilityMetricsProviderTest, | 38 FRIEND_TEST_ALL_PREFIXES(BlimpStabilityMetricsProviderTest, |
| 39 BrowserChildProcessObserver); | 39 BrowserChildProcessObserver); |
| 40 FRIEND_TEST_ALL_PREFIXES(ChromeStabilityMetricsProviderTest, | 40 FRIEND_TEST_ALL_PREFIXES(BlimpStabilityMetricsProviderTest, |
| 41 NotificationObserver); | 41 NotificationObserver); |
| 42 | 42 |
| 43 // content::NotificationObserver: | 43 // content::NotificationObserver: |
| 44 void Observe(int type, | 44 void Observe(int type, |
| 45 const content::NotificationSource& source, | 45 const content::NotificationSource& source, |
| 46 const content::NotificationDetails& details) override; | 46 const content::NotificationDetails& details) override; |
| 47 | 47 |
| 48 // content::BrowserChildProcessObserver: | 48 // content::BrowserChildProcessObserver: |
| 49 void BrowserChildProcessCrashed( | 49 void BrowserChildProcessCrashed( |
| 50 const content::ChildProcessData& data, | 50 const content::ChildProcessData& data, |
| 51 int exit_code) override; | 51 int exit_code) override; |
| 52 | 52 |
| 53 metrics::StabilityMetricsHelper helper_; | 53 metrics::StabilityMetricsHelper helper_; |
| 54 | 54 |
| 55 // Registrar for receiving stability-related notifications. | 55 // Registrar for receiving stability-related notifications. |
| 56 content::NotificationRegistrar registrar_; | 56 content::NotificationRegistrar registrar_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(ChromeStabilityMetricsProvider); | 58 DISALLOW_COPY_AND_ASSIGN(BlimpStabilityMetricsProvider); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ | 61 #endif // BLIMP_ENGINE_APP_BLIMP_STABILITY_METRICS_PROVIDER_H_ |
| OLD | NEW |