| 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 CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ | 5 #ifndef CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ |
| 6 #define CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ | 6 #define CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
| 10 #include "components/metrics/metrics_provider.h" | 10 #include "components/metrics/metrics_provider.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class CastStabilityMetricsProvider | 31 class CastStabilityMetricsProvider |
| 32 : public ::metrics::MetricsProvider, | 32 : public ::metrics::MetricsProvider, |
| 33 public content::BrowserChildProcessObserver, | 33 public content::BrowserChildProcessObserver, |
| 34 public content::NotificationObserver { | 34 public content::NotificationObserver { |
| 35 public: | 35 public: |
| 36 // Registers local state prefs used by this class. | 36 // Registers local state prefs used by this class. |
| 37 static void RegisterPrefs(PrefRegistrySimple* registry); | 37 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 38 | 38 |
| 39 explicit CastStabilityMetricsProvider( | 39 explicit CastStabilityMetricsProvider( |
| 40 ::metrics::MetricsService* metrics_service); | 40 ::metrics::MetricsService* metrics_service); |
| 41 virtual ~CastStabilityMetricsProvider(); | 41 ~CastStabilityMetricsProvider() override; |
| 42 | 42 |
| 43 // metrics::MetricsDataProvider implementation: | 43 // metrics::MetricsDataProvider implementation: |
| 44 virtual void OnRecordingEnabled() override; | 44 void OnRecordingEnabled() override; |
| 45 virtual void OnRecordingDisabled() override; | 45 void OnRecordingDisabled() override; |
| 46 virtual void ProvideStabilityMetrics( | 46 void ProvideStabilityMetrics( |
| 47 ::metrics::SystemProfileProto* system_profile_proto) override; | 47 ::metrics::SystemProfileProto* system_profile_proto) override; |
| 48 | 48 |
| 49 // Logs an external crash, presumably from the ExternalMetrics service. | 49 // Logs an external crash, presumably from the ExternalMetrics service. |
| 50 void LogExternalCrash(const std::string& crash_type); | 50 void LogExternalCrash(const std::string& crash_type); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 // content::NotificationObserver implementation: | 53 // content::NotificationObserver implementation: |
| 54 virtual void Observe(int type, | 54 void Observe(int type, |
| 55 const content::NotificationSource& source, | 55 const content::NotificationSource& source, |
| 56 const content::NotificationDetails& details) override; | 56 const content::NotificationDetails& details) override; |
| 57 | 57 |
| 58 // content::BrowserChildProcessObserver implementation: | 58 // content::BrowserChildProcessObserver implementation: |
| 59 virtual void BrowserChildProcessCrashed( | 59 void BrowserChildProcessCrashed( |
| 60 const content::ChildProcessData& data) override; | 60 const content::ChildProcessData& data) override; |
| 61 | 61 |
| 62 // Records a renderer process crash. | 62 // Records a renderer process crash. |
| 63 void LogRendererCrash(content::RenderProcessHost* host, | 63 void LogRendererCrash(content::RenderProcessHost* host, |
| 64 base::TerminationStatus status, | 64 base::TerminationStatus status, |
| 65 int exit_code); | 65 int exit_code); |
| 66 | 66 |
| 67 // Records a renderer process hang. | 67 // Records a renderer process hang. |
| 68 void LogRendererHang(); | 68 void LogRendererHang(); |
| 69 | 69 |
| 70 // Registrar for receiving stability-related notifications. | 70 // Registrar for receiving stability-related notifications. |
| 71 content::NotificationRegistrar registrar_; | 71 content::NotificationRegistrar registrar_; |
| 72 | 72 |
| 73 // Reference to the current MetricsService. Raw pointer is safe, since | 73 // Reference to the current MetricsService. Raw pointer is safe, since |
| 74 // MetricsService is responsible for the lifetime of | 74 // MetricsService is responsible for the lifetime of |
| 75 // CastStabilityMetricsProvider. | 75 // CastStabilityMetricsProvider. |
| 76 ::metrics::MetricsService* metrics_service_; | 76 ::metrics::MetricsService* metrics_service_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(CastStabilityMetricsProvider); | 78 DISALLOW_COPY_AND_ASSIGN(CastStabilityMetricsProvider); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace metrics | 81 } // namespace metrics |
| 82 } // namespace chromecast | 82 } // namespace chromecast |
| 83 | 83 |
| 84 #endif // CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ | 84 #endif // CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ |
| OLD | NEW |