OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/metrics/user_metrics.h" |
| 10 #include "base/process/kill.h" |
| 11 #include "components/metrics/metrics_provider.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
| 14 |
| 15 namespace content { |
| 16 class RenderProcessHost; |
| 17 class WebContents; |
| 18 } |
| 19 |
| 20 // ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability- |
| 21 // related metrics. |
| 22 class ChromeStabilityMetricsProvider : public metrics::MetricsProvider, |
| 23 public content::NotificationObserver { |
| 24 public: |
| 25 ChromeStabilityMetricsProvider(); |
| 26 virtual ~ChromeStabilityMetricsProvider(); |
| 27 |
| 28 // metrics::MetricsDataProvider: |
| 29 virtual void OnRecordingEnabled() OVERRIDE; |
| 30 virtual void OnRecordingDisabled() OVERRIDE; |
| 31 virtual void ProvideStabilityMetrics( |
| 32 metrics::SystemProfileProto_Stability* stability_proto) OVERRIDE; |
| 33 |
| 34 private: |
| 35 // content::NotificationObserver: |
| 36 virtual void Observe(int type, |
| 37 const content::NotificationSource& source, |
| 38 const content::NotificationDetails& details) OVERRIDE; |
| 39 |
| 40 // Logs the initiation of a page load and uses |web_contents| to do |
| 41 // additional logging of the type of page loaded. |
| 42 void LogLoadStarted(content::WebContents* web_contents); |
| 43 |
| 44 // Records a renderer process crash. |
| 45 void LogRendererCrash(content::RenderProcessHost* host, |
| 46 base::TerminationStatus status, |
| 47 int exit_code); |
| 48 |
| 49 // Records a renderer process hang. |
| 50 void LogRendererHang(); |
| 51 |
| 52 // Registrar for receiving stability-related notifications. |
| 53 content::NotificationRegistrar registrar_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ChromeStabilityMetricsProvider); |
| 56 }; |
| 57 |
| 58 #endif // CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ |
OLD | NEW |