OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines a service that collects information about the user | 5 // This file defines a service that collects information about the user |
6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
7 | 7 |
8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
10 | 10 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 SENDING_CURRENT_LOGS, // Sending ongoing logs as they accrue. | 251 SENDING_CURRENT_LOGS, // Sending ongoing logs as they accrue. |
252 }; | 252 }; |
253 | 253 |
254 enum ShutdownCleanliness { | 254 enum ShutdownCleanliness { |
255 CLEANLY_SHUTDOWN = 0xdeadbeef, | 255 CLEANLY_SHUTDOWN = 0xdeadbeef, |
256 NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN | 256 NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN |
257 }; | 257 }; |
258 | 258 |
259 typedef std::vector<SyntheticTrialGroup> SyntheticTrialGroups; | 259 typedef std::vector<SyntheticTrialGroup> SyntheticTrialGroups; |
260 | 260 |
261 // First part of the init task. Called on the FILE thread to load hardware | 261 // Calls into the client to start metrics gathering. |
262 // class information. | 262 void StartGatheringMetrics(); |
263 static void InitTaskGetHardwareClass(base::WeakPtr<MetricsService> self, | |
264 base::MessageLoopProxy* target_loop); | |
265 | 263 |
266 // Callback from InitTaskGetHardwareClass() that continues the init task by | 264 // Callback that continues the init task by loading plugin information. |
267 // loading plugin information. | 265 void OnInitTaskGotHardwareClass(); |
268 void OnInitTaskGotHardwareClass(const std::string& hardware_class); | |
269 | 266 |
270 // Called after the Plugin init task has been completed that continues the | 267 // Called after the Plugin init task has been completed that continues the |
271 // init task by launching a task to gather Google Update statistics. | 268 // init task by launching a task to gather Google Update statistics. |
272 void OnInitTaskGotPluginInfo(); | 269 void OnInitTaskGotPluginInfo(); |
273 | 270 |
274 // Called after GoogleUpdate init task has been completed that continues the | 271 // Called after GoogleUpdate init task has been completed that continues the |
275 // init task by loading profiler data. | 272 // init task by loading profiler data. |
276 void OnInitTaskGotGoogleUpdateData(); | 273 void OnInitTaskGotGoogleUpdateData(); |
277 | 274 |
278 void OnUserAction(const std::string& action); | 275 void OnUserAction(const std::string& action); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 // be cut, and logs are neither persisted nor uploaded. | 433 // be cut, and logs are neither persisted nor uploaded. |
437 bool test_mode_active_; | 434 bool test_mode_active_; |
438 | 435 |
439 // The progression of states made by the browser are recorded in the following | 436 // The progression of states made by the browser are recorded in the following |
440 // state. | 437 // state. |
441 State state_; | 438 State state_; |
442 | 439 |
443 // Whether the initial stability log has been recorded during startup. | 440 // Whether the initial stability log has been recorded during startup. |
444 bool has_initial_stability_log_; | 441 bool has_initial_stability_log_; |
445 | 442 |
446 // Chrome OS hardware class (e.g., hardware qualification ID). This | |
447 // class identifies the configured system components such as CPU, | |
448 // WiFi adapter, etc. For non Chrome OS hosts, this will be an | |
449 // empty string. | |
450 std::string hardware_class_; | |
451 | |
452 #if defined(ENABLE_PLUGINS) | 443 #if defined(ENABLE_PLUGINS) |
453 PluginMetricsProvider* plugin_metrics_provider_; | 444 PluginMetricsProvider* plugin_metrics_provider_; |
454 #endif | 445 #endif |
455 | 446 |
456 #if defined(OS_WIN) | 447 #if defined(OS_WIN) |
457 GoogleUpdateMetricsProviderWin* google_update_metrics_provider_; | 448 GoogleUpdateMetricsProviderWin* google_update_metrics_provider_; |
458 #endif | 449 #endif |
459 | 450 |
460 // The initial metrics log, used to record startup metrics (histograms and | 451 // The initial metrics log, used to record startup metrics (histograms and |
461 // profiler data). Note that if a crash occurred in the previous session, an | 452 // profiler data). Note that if a crash occurred in the previous session, an |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); | 504 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); |
514 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsServiceObserver); | 505 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsServiceObserver); |
515 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, | 506 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, |
516 PermutedEntropyCacheClearedWhenLowEntropyReset); | 507 PermutedEntropyCacheClearedWhenLowEntropyReset); |
517 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); | 508 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); |
518 | 509 |
519 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 510 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
520 }; | 511 }; |
521 | 512 |
522 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 513 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |