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

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

Issue 301633006: Move ChromeOS hardware class init out of MetricsService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.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_METRICS_SERVICE_CLIENT_H_ 5 #ifndef CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ 6 #define CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "chrome/browser/metrics/network_stats_uploader.h" 15 #include "chrome/browser/metrics/network_stats_uploader.h"
16 #include "components/metrics/metrics_service_client.h" 16 #include "components/metrics/metrics_service_client.h"
17 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
19 19
20 class ChromeOSMetricsProvider;
20 class MetricsService; 21 class MetricsService;
21 22
22 namespace metrics { 23 namespace metrics {
23 class MetricsStateManager; 24 class MetricsStateManager;
24 } 25 }
25 26
26 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient 27 // ChromeMetricsServiceClient provides an implementation of MetricsServiceClient
27 // that depends on chrome/. 28 // that depends on chrome/.
28 class ChromeMetricsServiceClient : public metrics::MetricsServiceClient, 29 class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
29 public content::NotificationObserver { 30 public content::NotificationObserver {
(...skipping 17 matching lines...) Expand all
47 const base::Closure& done_callback) OVERRIDE; 48 const base::Closure& done_callback) OVERRIDE;
48 virtual void CollectFinalMetrics(const base::Closure& done_callback) 49 virtual void CollectFinalMetrics(const base::Closure& done_callback)
49 OVERRIDE; 50 OVERRIDE;
50 51
51 MetricsService* metrics_service() { return metrics_service_.get(); } 52 MetricsService* metrics_service() { return metrics_service_.get(); }
52 53
53 private: 54 private:
54 explicit ChromeMetricsServiceClient( 55 explicit ChromeMetricsServiceClient(
55 metrics::MetricsStateManager* state_manager); 56 metrics::MetricsStateManager* state_manager);
56 57
58 // Completes the two-phase initialization of ChromeMetricsServiceClient.
59 void Initialize();
60
57 // Callbacks for various stages of final log info collection. Do not call 61 // Callbacks for various stages of final log info collection. Do not call
58 // these directly. 62 // these directly.
59 void OnMemoryDetailCollectionDone(); 63 void OnMemoryDetailCollectionDone();
60 void OnHistogramSynchronizationDone(); 64 void OnHistogramSynchronizationDone();
61 65
62 // Records metrics about the switches present on the command line. 66 // Records metrics about the switches present on the command line.
63 void RecordCommandLineMetrics(); 67 void RecordCommandLineMetrics();
64 68
65 // Registers |this| as an observer for notifications which indicate that a 69 // Registers |this| as an observer for notifications which indicate that a
66 // user is performing work. This is useful to allow some features to sleep, 70 // user is performing work. This is useful to allow some features to sleep,
67 // until the machine becomes active, such as precluding UMA uploads unless 71 // until the machine becomes active, such as precluding UMA uploads unless
68 // there was recent activity. 72 // there was recent activity.
69 void RegisterForNotifications(); 73 void RegisterForNotifications();
70 74
71 // content::NotificationObserver: 75 // content::NotificationObserver:
72 virtual void Observe(int type, 76 virtual void Observe(int type,
73 const content::NotificationSource& source, 77 const content::NotificationSource& source,
74 const content::NotificationDetails& details) OVERRIDE; 78 const content::NotificationDetails& details) OVERRIDE;
75 79
76 #if defined(OS_WIN) 80 #if defined(OS_WIN)
77 // Counts (and removes) the browser crash dump attempt signals left behind by 81 // Counts (and removes) the browser crash dump attempt signals left behind by
78 // any previous browser processes which generated a crash dump. 82 // any previous browser processes which generated a crash dump.
79 void CountBrowserCrashDumpAttempts(); 83 void CountBrowserCrashDumpAttempts();
80 #endif // OS_WIN 84 #endif // OS_WIN
81 85
82 base::ThreadChecker thread_checker_; 86 base::ThreadChecker thread_checker_;
83 87
88 // Weak pointer to the MetricsStateManager.
89 metrics::MetricsStateManager* metrics_state_manager_;
90
84 // The MetricsService that |this| is a client of. 91 // The MetricsService that |this| is a client of.
85 scoped_ptr<MetricsService> metrics_service_; 92 scoped_ptr<MetricsService> metrics_service_;
86 93
87 content::NotificationRegistrar registrar_; 94 content::NotificationRegistrar registrar_;
88 95
96 // On ChromeOS, holds a weak pointer to the ChromeOSMetricsProvider instance
97 // that has been registered with MetricsService. On other platforms, is NULL.
98 ChromeOSMetricsProvider* chromeos_metrics_provider_;
99
89 NetworkStatsUploader network_stats_uploader_; 100 NetworkStatsUploader network_stats_uploader_;
90 101
91 // Saved callback received from CollectFinalMetrics(). 102 // Saved callback received from CollectFinalMetrics().
92 base::Closure collect_final_metrics_done_callback_; 103 base::Closure collect_final_metrics_done_callback_;
93 104
94 // Indicates that collect final metrics step is running. 105 // Indicates that collect final metrics step is running.
95 bool waiting_for_collect_final_metrics_step_; 106 bool waiting_for_collect_final_metrics_step_;
96 107
97 // Number of async histogram fetch requests in progress. 108 // Number of async histogram fetch requests in progress.
98 int num_async_histogram_fetches_in_progress_; 109 int num_async_histogram_fetches_in_progress_;
99 110
100 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_; 111 base::WeakPtrFactory<ChromeMetricsServiceClient> weak_ptr_factory_;
101 112
102 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient); 113 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceClient);
103 }; 114 };
104 115
105 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_ 116 #endif // CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698