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

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

Issue 301633006: Move ChromeOS hardware class init out of MetricsService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review 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
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_CHROMEOS_METRICS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_
6 #define CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_ 6 #define CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "chrome/browser/metrics/perf_provider_chromeos.h" 9 #include "chrome/browser/metrics/perf_provider_chromeos.h"
9 #include "components/metrics/metrics_provider.h" 10 #include "components/metrics/metrics_provider.h"
10 11
11 namespace device { 12 namespace device {
12 class BluetoothAdapter; 13 class BluetoothAdapter;
13 } 14 }
14 15
15 namespace metrics { 16 namespace metrics {
16 class ChromeUserMetricsExtension; 17 class ChromeUserMetricsExtension;
17 } 18 }
18 19
19 class PrefRegistrySimple; 20 class PrefRegistrySimple;
20 class PrefService; 21 class PrefService;
21 22
22 // Performs ChromeOS specific metrics logging. 23 // Performs ChromeOS specific metrics logging.
23 class ChromeOSMetricsProvider : public metrics::MetricsProvider { 24 class ChromeOSMetricsProvider : public metrics::MetricsProvider {
24 public: 25 public:
25 ChromeOSMetricsProvider(); 26 ChromeOSMetricsProvider();
26 virtual ~ChromeOSMetricsProvider(); 27 virtual ~ChromeOSMetricsProvider();
27 28
28 static void RegisterPrefs(PrefRegistrySimple* registry); 29 static void RegisterPrefs(PrefRegistrySimple* registry);
29 30
30 // Records a crash. 31 // Records a crash.
31 static void LogCrash(const std::string& crash_type); 32 static void LogCrash(const std::string& crash_type);
32 33
34 // Loads hardware class information. When this task is complete, |callback|
35 // is run.
36 void InitTaskGetHardwareClass(const base::Closure& callback);
37
33 // metrics::MetricsProvider: 38 // metrics::MetricsProvider:
34 virtual void OnDidCreateMetricsLog() OVERRIDE; 39 virtual void OnDidCreateMetricsLog() OVERRIDE;
35 virtual void ProvideSystemProfileMetrics( 40 virtual void ProvideSystemProfileMetrics(
36 metrics::SystemProfileProto* system_profile_proto) OVERRIDE; 41 metrics::SystemProfileProto* system_profile_proto) OVERRIDE;
37 virtual void ProvideStabilityMetrics( 42 virtual void ProvideStabilityMetrics(
38 metrics::SystemProfileProto* system_profile_proto) OVERRIDE; 43 metrics::SystemProfileProto* system_profile_proto) OVERRIDE;
39 44
40 private: 45 private:
46 // Called on the FILE thread to load hardware class information.
47 void InitTaskGetHardwareClassOnFileThread();
48
41 // Update the number of users logged into a multi-profile session. 49 // Update the number of users logged into a multi-profile session.
42 // If the number of users change while the log is open, the call invalidates 50 // If the number of users change while the log is open, the call invalidates
43 // the user count value. 51 // the user count value.
44 void UpdateMultiProfileUserCount( 52 void UpdateMultiProfileUserCount(
45 metrics::SystemProfileProto* system_profile_proto); 53 metrics::SystemProfileProto* system_profile_proto);
46 54
47 // Sets the Bluetooth Adapter instance used for the WriteBluetoothProto() 55 // Sets the Bluetooth Adapter instance used for the WriteBluetoothProto()
48 // call. 56 // call.
49 void SetBluetoothAdapter(scoped_refptr<device::BluetoothAdapter> adapter); 57 void SetBluetoothAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
50 58
51 // Writes info about paired Bluetooth devices on this system. 59 // Writes info about paired Bluetooth devices on this system.
52 void WriteBluetoothProto(metrics::SystemProfileProto* system_profile_proto); 60 void WriteBluetoothProto(metrics::SystemProfileProto* system_profile_proto);
53 61
54 metrics::PerfProvider perf_provider_; 62 metrics::PerfProvider perf_provider_;
55 63
56 // Bluetooth Adapter instance for collecting information about paired devices. 64 // Bluetooth Adapter instance for collecting information about paired devices.
57 scoped_refptr<device::BluetoothAdapter> adapter_; 65 scoped_refptr<device::BluetoothAdapter> adapter_;
58 metrics::ChromeUserMetricsExtension* uma_proto_; 66 metrics::ChromeUserMetricsExtension* uma_proto_;
59 67
60 // Whether the user count was registered at the last log initialization. 68 // Whether the user count was registered at the last log initialization.
61 bool registered_user_count_at_log_initialization_; 69 bool registered_user_count_at_log_initialization_;
62 70
63 // The user count at the time that a log was last initialized. Contains a 71 // The user count at the time that a log was last initialized. Contains a
64 // valid value only if |registered_user_count_at_log_initialization_| is 72 // valid value only if |registered_user_count_at_log_initialization_| is
65 // true. 73 // true.
66 uint64 user_count_at_log_initialization_; 74 uint64 user_count_at_log_initialization_;
67 75
76 // Hardware class (e.g., hardware qualification ID). This class identifies
77 // the configured system components such as CPU, WiFi adapter, etc.
78 std::string hardware_class_;
79
80 base::WeakPtrFactory<ChromeOSMetricsProvider> weak_ptr_factory_;
81
68 DISALLOW_COPY_AND_ASSIGN(ChromeOSMetricsProvider); 82 DISALLOW_COPY_AND_ASSIGN(ChromeOSMetricsProvider);
69 }; 83 };
70 84
71 #endif // CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_ 85 #endif // CHROME_BROWSER_METRICS_CHROMEOS_METRICS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698