Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/metrics/chrome_stability_metrics_provider.h

Issue 299153004: Move child process observing from MetricsService to stability provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_stability_metrics_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CHROME_STABILITY_METRICS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_
6 #define CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ 6 #define CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/metrics/user_metrics.h" 9 #include "base/metrics/user_metrics.h"
10 #include "base/process/kill.h" 10 #include "base/process/kill.h"
11 #include "components/metrics/metrics_provider.h" 11 #include "components/metrics/metrics_provider.h"
12 #include "content/public/browser/browser_child_process_observer.h"
12 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
14 15
16 class PrefRegistrySimple;
17
15 namespace content { 18 namespace content {
16 class RenderProcessHost; 19 class RenderProcessHost;
17 class WebContents; 20 class WebContents;
18 } 21 }
19 22
20 // ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability- 23 // ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability-
21 // related metrics. 24 // related metrics.
22 class ChromeStabilityMetricsProvider : public metrics::MetricsProvider, 25 class ChromeStabilityMetricsProvider
23 public content::NotificationObserver { 26 : public metrics::MetricsProvider,
27 public content::BrowserChildProcessObserver,
28 public content::NotificationObserver {
24 public: 29 public:
25 ChromeStabilityMetricsProvider(); 30 ChromeStabilityMetricsProvider();
26 virtual ~ChromeStabilityMetricsProvider(); 31 virtual ~ChromeStabilityMetricsProvider();
27 32
28 // metrics::MetricsDataProvider: 33 // metrics::MetricsDataProvider:
29 virtual void OnRecordingEnabled() OVERRIDE; 34 virtual void OnRecordingEnabled() OVERRIDE;
30 virtual void OnRecordingDisabled() OVERRIDE; 35 virtual void OnRecordingDisabled() OVERRIDE;
31 virtual void ProvideStabilityMetrics( 36 virtual void ProvideStabilityMetrics(
32 metrics::SystemProfileProto* system_profile_proto) OVERRIDE; 37 metrics::SystemProfileProto* system_profile_proto) OVERRIDE;
33 38
39 // Registers local state prefs used by this class.
40 static void RegisterPrefs(PrefRegistrySimple* registry);
41
34 private: 42 private:
35 // content::NotificationObserver: 43 // content::NotificationObserver:
36 virtual void Observe(int type, 44 virtual void Observe(int type,
37 const content::NotificationSource& source, 45 const content::NotificationSource& source,
38 const content::NotificationDetails& details) OVERRIDE; 46 const content::NotificationDetails& details) OVERRIDE;
39 47
48 // content::BrowserChildProcessObserver:
49 virtual void BrowserChildProcessCrashed(
50 const content::ChildProcessData& data) OVERRIDE;
51
40 // Logs the initiation of a page load and uses |web_contents| to do 52 // Logs the initiation of a page load and uses |web_contents| to do
41 // additional logging of the type of page loaded. 53 // additional logging of the type of page loaded.
42 void LogLoadStarted(content::WebContents* web_contents); 54 void LogLoadStarted(content::WebContents* web_contents);
43 55
44 // Records a renderer process crash. 56 // Records a renderer process crash.
45 void LogRendererCrash(content::RenderProcessHost* host, 57 void LogRendererCrash(content::RenderProcessHost* host,
46 base::TerminationStatus status, 58 base::TerminationStatus status,
47 int exit_code); 59 int exit_code);
48 60
49 // Records a renderer process hang. 61 // Records a renderer process hang.
50 void LogRendererHang(); 62 void LogRendererHang();
51 63
52 // Registrar for receiving stability-related notifications. 64 // Registrar for receiving stability-related notifications.
53 content::NotificationRegistrar registrar_; 65 content::NotificationRegistrar registrar_;
54 66
55 DISALLOW_COPY_AND_ASSIGN(ChromeStabilityMetricsProvider); 67 DISALLOW_COPY_AND_ASSIGN(ChromeStabilityMetricsProvider);
56 }; 68 };
57 69
58 #endif // CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_ 70 #endif // CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_stability_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698