Chromium Code Reviews| Index: chrome/browser/metrics/metrics_service.h |
| =================================================================== |
| --- chrome/browser/metrics/metrics_service.h (revision 238735) |
| +++ chrome/browser/metrics/metrics_service.h (working copy) |
| @@ -111,9 +111,21 @@ |
| SHUTDOWN_COMPLETE = 700, |
| }; |
| + enum ReportingState { |
| + REPORTING_ENABLED, |
| + REPORTING_DISABLED, |
| + }; |
| + |
| MetricsService(); |
| virtual ~MetricsService(); |
| + // Initializes metrics recording state. Updates various bookkeeping values in |
| + // prefs and sets up the scheduler. This is a separate function rather than |
| + // being done by the constructor so that field trials could be created before |
| + // this is run. Takes |reporting_state| parameter which specifies whether UMA |
| + // is enabled. |
| + void InitializeMetricsRecordingState(ReportingState reporting_state); |
| + |
| // Starts the metrics system, turning on recording and uploading of metrics. |
| // Should be called when starting up with metrics enabled, or when metrics |
| // are turned on. |
| @@ -153,7 +165,7 @@ |
| // because this method may need to be called before the MetricsService needs |
| // to be started. |
| scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider( |
| - bool reporting_will_be_enabled); |
| + ReportingState reporting_state); |
| // Force the client ID to be generated. This is useful in case it's needed |
| // before recording. |
| @@ -253,12 +265,13 @@ |
| // The MetricsService has a lifecycle that is stored as a state. |
| // See metrics_service.cc for description of this lifecycle. |
| enum State { |
| - INITIALIZED, // Constructor was called. |
| - INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to complete. |
| - INIT_TASK_DONE, // Waiting for timer to send initial log. |
| - INITIAL_LOG_READY, // Initial log generated, and waiting for reply. |
| - SENDING_OLD_LOGS, // Sending unsent logs from previous session. |
| - SENDING_CURRENT_LOGS, // Sending standard current logs as they acrue. |
| + INITIALIZED, // Constructor was called. |
| + INIT_TASK_SCHEDULED, // Waiting for deferred init task to finish. |
| + INIT_TASK_DONE, // Waiting for timer to send initial log. |
| + SENDING_INITIAL_STABILITY_LOG, // Initial stability log being sent. |
| + SENDING_INITIAL_METRICS_LOG, // Initial metrics log being sent. |
| + SENDING_OLD_LOGS, // Sending unsent logs from last session. |
| + SENDING_CURRENT_LOGS, // Sending ongoing logs as they accrue. |
| }; |
| enum ShutdownCleanliness { |
| @@ -349,7 +362,7 @@ |
| void HandleIdleSinceLastTransmission(bool in_idle); |
| // Set up client ID, session ID, etc. |
| - void InitializeMetricsState(); |
| + void InitializeMetricsState(ReportingState reporting_state); |
| // Generates a new client ID to use to identify self to metrics server. |
| static std::string GenerateClientID(); |
| @@ -393,9 +406,15 @@ |
| // (depending on |state_|), and stages it for upload. |
| void StageNewLog(); |
| - // Record stats, client ID, Session ID, etc. in a special "first" log. |
| - void PrepareInitialLog(); |
| + // Prepares the initial stability log, based on the saved system profile from |
| + // a previous session with updated stability stats (only) and stages it for |
| + // upload. |
|
Ilya Sherman
2013/12/07 06:51:54
nit: Sorry to super nitpick, but I still find this
Alexei Svitkine (slow)
2013/12/09 21:17:02
Done.
|
| + void PrepareInitialStabilityLog(); |
| + // Prepares the initial metrics log, which includes startup histograms and |
| + // profiler data, as well as incremental stability-related metrics. |
| + void PrepareInitialMetricsLog(MetricsLog::LogType log_type); |
| + |
| // Uploads the currently staged log (which must be non-null). |
| void SendStagedLog(); |
| @@ -487,8 +506,10 @@ |
| // Google Update statistics, which were retrieved on a blocking pool thread. |
| GoogleUpdateMetrics google_update_metrics_; |
| - // The initial log, used to record startup metrics. |
| - scoped_ptr<MetricsLog> initial_log_; |
| + // The initial metrics log, used to record startup metrics (histograms and |
| + // profiler data). Note that if a crash occurred in the previous session, an |
| + // initial stability log may be sent before this. |
| + scoped_ptr<MetricsLog> initial_metrics_log_; |
| // The outstanding transmission appears as a URL Fetch operation. |
| scoped_ptr<net::URLFetcher> current_fetch_; |