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

Side by Side Diff: components/metrics/metrics_service.h

Issue 2689323010: Split a MetricsLogStore object out of MetricsLogManager. (Closed)
Patch Set: Incorporate Feedback Created 3 years, 10 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 // 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 COMPONENTS_METRICS_METRICS_SERVICE_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_
9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_
10 10
(...skipping 13 matching lines...) Expand all
24 #include "base/metrics/user_metrics.h" 24 #include "base/metrics/user_metrics.h"
25 #include "base/observer_list.h" 25 #include "base/observer_list.h"
26 #include "base/threading/thread_checker.h" 26 #include "base/threading/thread_checker.h"
27 #include "base/time/time.h" 27 #include "base/time/time.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "components/metrics/clean_exit_beacon.h" 29 #include "components/metrics/clean_exit_beacon.h"
30 #include "components/metrics/data_use_tracker.h" 30 #include "components/metrics/data_use_tracker.h"
31 #include "components/metrics/execution_phase.h" 31 #include "components/metrics/execution_phase.h"
32 #include "components/metrics/metrics_log.h" 32 #include "components/metrics/metrics_log.h"
33 #include "components/metrics/metrics_log_manager.h" 33 #include "components/metrics/metrics_log_manager.h"
34 #include "components/metrics/metrics_log_store.h"
34 #include "components/metrics/metrics_provider.h" 35 #include "components/metrics/metrics_provider.h"
35 #include "components/metrics/net/network_metrics_provider.h" 36 #include "components/metrics/net/network_metrics_provider.h"
36 #include "components/variations/synthetic_trials.h" 37 #include "components/variations/synthetic_trials.h"
37 38
38 class PrefService; 39 class PrefService;
39 class PrefRegistrySimple; 40 class PrefRegistrySimple;
40 41
41 namespace base { 42 namespace base {
42 class HistogramSamples; 43 class HistogramSamples;
43 class PrefService; 44 class PrefService;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void PushExternalLog(const std::string& log); 194 void PushExternalLog(const std::string& log);
194 195
195 // Updates data usage tracking prefs with the specified values. 196 // Updates data usage tracking prefs with the specified values.
196 void UpdateMetricsUsagePrefs(const std::string& service_name, 197 void UpdateMetricsUsagePrefs(const std::string& service_name,
197 int message_size, 198 int message_size,
198 bool is_cellular); 199 bool is_cellular);
199 200
200 protected: 201 protected:
201 // Exposed for testing. 202 // Exposed for testing.
202 MetricsLogManager* log_manager() { return &log_manager_; } 203 MetricsLogManager* log_manager() { return &log_manager_; }
204 MetricsLogStore* log_store() { return &log_store_; }
203 205
204 private: 206 private:
205 friend class MetricsServiceAccessor; 207 friend class MetricsServiceAccessor;
206 208
207 // The MetricsService has a lifecycle that is stored as a state. 209 // The MetricsService has a lifecycle that is stored as a state.
208 // See metrics_service.cc for description of this lifecycle. 210 // See metrics_service.cc for description of this lifecycle.
209 enum State { 211 enum State {
210 INITIALIZED, // Constructor was called. 212 INITIALIZED, // Constructor was called.
211 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to finish. 213 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to finish.
212 INIT_TASK_DONE, // Waiting for timer to send initial log. 214 INIT_TASK_DONE, // Waiting for timer to send initial log.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // Called when we close a log. 362 // Called when we close a log.
361 void RecordCurrentHistograms(); 363 void RecordCurrentHistograms();
362 364
363 // Record complete list of stability histograms into the current log, 365 // Record complete list of stability histograms into the current log,
364 // i.e., histograms with the |kUmaStabilityHistogramFlag| flag set. 366 // i.e., histograms with the |kUmaStabilityHistogramFlag| flag set.
365 void RecordCurrentStabilityHistograms(); 367 void RecordCurrentStabilityHistograms();
366 368
367 // Manager for the various in-flight logs. 369 // Manager for the various in-flight logs.
368 MetricsLogManager log_manager_; 370 MetricsLogManager log_manager_;
369 371
372 // Store of logs ready to be uploaded.
373 MetricsLogStore log_store_;
374
370 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. 375 // |histogram_snapshot_manager_| prepares histogram deltas for transmission.
371 base::HistogramSnapshotManager histogram_snapshot_manager_; 376 base::HistogramSnapshotManager histogram_snapshot_manager_;
372 377
373 // Used to manage various metrics reporting state prefs, such as client id, 378 // Used to manage various metrics reporting state prefs, such as client id,
374 // low entropy source and whether metrics reporting is enabled. Weak pointer. 379 // low entropy source and whether metrics reporting is enabled. Weak pointer.
375 MetricsStateManager* const state_manager_; 380 MetricsStateManager* const state_manager_;
376 381
377 // Used to interact with the embedder. Weak pointer; must outlive |this| 382 // Used to interact with the embedder. Weak pointer; must outlive |this|
378 // instance. 383 // instance.
379 MetricsServiceClient* const client_; 384 MetricsServiceClient* const client_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // Weak pointers factory used to post task on different threads. All weak 464 // Weak pointers factory used to post task on different threads. All weak
460 // pointers managed by this factory have the same lifetime as MetricsService. 465 // pointers managed by this factory have the same lifetime as MetricsService.
461 base::WeakPtrFactory<MetricsService> self_ptr_factory_; 466 base::WeakPtrFactory<MetricsService> self_ptr_factory_;
462 467
463 DISALLOW_COPY_AND_ASSIGN(MetricsService); 468 DISALLOW_COPY_AND_ASSIGN(MetricsService);
464 }; 469 };
465 470
466 } // namespace metrics 471 } // namespace metrics
467 472
468 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ 473 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698