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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 MetricsService(); | 135 MetricsService(); |
136 virtual ~MetricsService(); | 136 virtual ~MetricsService(); |
137 | 137 |
138 // Initializes metrics recording state. Updates various bookkeeping values in | 138 // Initializes metrics recording state. Updates various bookkeeping values in |
139 // prefs and sets up the scheduler. This is a separate function rather than | 139 // prefs and sets up the scheduler. This is a separate function rather than |
140 // being done by the constructor so that field trials could be created before | 140 // being done by the constructor so that field trials could be created before |
141 // this is run. Takes |reporting_state| parameter which specifies whether UMA | 141 // this is run. Takes |reporting_state| parameter which specifies whether UMA |
142 // is enabled. | 142 // is enabled. |
143 void InitializeMetricsRecordingState(ReportingState reporting_state); | 143 void InitializeMetricsRecordingState(ReportingState reporting_state); |
144 | 144 |
145 // Initializes low entropy source, and, if the client has | |
146 void InitializeVariationsState(bool recording_enabled); | |
Alexei Svitkine (slow)
2014/03/28 15:00:17
It's not really variations state, since UMA client
jwd
2014/03/28 16:23:50
Done.
| |
147 | |
145 // Starts the metrics system, turning on recording and uploading of metrics. | 148 // Starts the metrics system, turning on recording and uploading of metrics. |
146 // Should be called when starting up with metrics enabled, or when metrics | 149 // Should be called when starting up with metrics enabled, or when metrics |
147 // are turned on. | 150 // are turned on. |
148 void Start(); | 151 void Start(); |
149 | 152 |
150 // Starts the metrics system in a special test-only mode. Metrics won't ever | 153 // Starts the metrics system in a special test-only mode. Metrics won't ever |
151 // be uploaded or persisted in this mode, but metrics will be recorded in | 154 // be uploaded or persisted in this mode, but metrics will be recorded in |
152 // memory. | 155 // memory. |
153 void StartRecordingForTests(); | 156 void StartRecordingForTests(); |
154 | 157 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 // is registered for a given trial name will be recorded. The values passed | 289 // is registered for a given trial name will be recorded. The values passed |
287 // in must not correspond to any real field trial in the code. | 290 // in must not correspond to any real field trial in the code. |
288 // To use this method, SyntheticTrialGroup should friend your class. | 291 // To use this method, SyntheticTrialGroup should friend your class. |
289 void RegisterSyntheticFieldTrial(const SyntheticTrialGroup& trial_group); | 292 void RegisterSyntheticFieldTrial(const SyntheticTrialGroup& trial_group); |
290 | 293 |
291 // Check if this install was cloned or imaged from another machine. If a | 294 // Check if this install was cloned or imaged from another machine. If a |
292 // clone is detected, reset the client id and low entropy source. This | 295 // clone is detected, reset the client id and low entropy source. This |
293 // should not be called more than once. | 296 // should not be called more than once. |
294 void CheckForClonedInstall(); | 297 void CheckForClonedInstall(); |
295 | 298 |
299 void ResetVariationsState(); | |
Alexei Svitkine (slow)
2014/03/28 15:00:17
Private?
jwd
2014/03/28 16:23:50
Done.
| |
300 | |
296 private: | 301 private: |
297 // The MetricsService has a lifecycle that is stored as a state. | 302 // The MetricsService has a lifecycle that is stored as a state. |
298 // See metrics_service.cc for description of this lifecycle. | 303 // See metrics_service.cc for description of this lifecycle. |
299 enum State { | 304 enum State { |
300 INITIALIZED, // Constructor was called. | 305 INITIALIZED, // Constructor was called. |
301 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to | 306 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to |
302 // complete. | 307 // complete. |
303 INIT_TASK_DONE, // Waiting for timer to send initial log. | 308 INIT_TASK_DONE, // Waiting for timer to send initial log. |
304 SENDING_INITIAL_STABILITY_LOG, // Initial stability log being sent. | 309 SENDING_INITIAL_STABILITY_LOG, // Initial stability log being sent. |
305 SENDING_INITIAL_METRICS_LOG, // Initial metrics log being sent. | 310 SENDING_INITIAL_METRICS_LOG, // Initial metrics log being sent. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 | 521 |
517 // Returns a list of synthetic field trials that were active for the entire | 522 // Returns a list of synthetic field trials that were active for the entire |
518 // duration of the current log. | 523 // duration of the current log. |
519 void GetCurrentSyntheticFieldTrials( | 524 void GetCurrentSyntheticFieldTrials( |
520 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials); | 525 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials); |
521 | 526 |
522 base::ActionCallback action_callback_; | 527 base::ActionCallback action_callback_; |
523 | 528 |
524 content::NotificationRegistrar registrar_; | 529 content::NotificationRegistrar registrar_; |
525 | 530 |
531 bool variations_state_initialized_; | |
532 | |
526 // Indicate whether recording and reporting are currently happening. | 533 // Indicate whether recording and reporting are currently happening. |
527 // These should not be set directly, but by calling SetRecording and | 534 // These should not be set directly, but by calling SetRecording and |
528 // SetReporting. | 535 // SetReporting. |
529 bool recording_active_; | 536 bool recording_active_; |
530 bool reporting_active_; | 537 bool reporting_active_; |
531 | 538 |
532 // Indicate whether test mode is enabled, where the initial log should never | 539 // Indicate whether test mode is enabled, where the initial log should never |
533 // be cut, and logs are neither persisted nor uploaded. | 540 // be cut, and logs are neither persisted nor uploaded. |
534 bool test_mode_active_; | 541 bool test_mode_active_; |
535 | 542 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
668 | 675 |
669 // Returns true if crash reporting is enabled. This is set at the platform | 676 // Returns true if crash reporting is enabled. This is set at the platform |
670 // level for Android and ChromeOS, and otherwise is the same as | 677 // level for Android and ChromeOS, and otherwise is the same as |
671 // IsMetricsReportingEnabled for desktop Chrome. | 678 // IsMetricsReportingEnabled for desktop Chrome. |
672 static bool IsCrashReportingEnabled(); | 679 static bool IsCrashReportingEnabled(); |
673 | 680 |
674 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 681 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
675 }; | 682 }; |
676 | 683 |
677 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 684 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |