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

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

Issue 2689323010: Split a MetricsLogStore object out of MetricsLogManager. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « components/metrics/metrics_log_store_unittest.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // Called when we close a log. 359 // Called when we close a log.
358 void RecordCurrentHistograms(); 360 void RecordCurrentHistograms();
359 361
360 // Record complete list of stability histograms into the current log, 362 // Record complete list of stability histograms into the current log,
361 // i.e., histograms with the |kUmaStabilityHistogramFlag| flag set. 363 // i.e., histograms with the |kUmaStabilityHistogramFlag| flag set.
362 void RecordCurrentStabilityHistograms(); 364 void RecordCurrentStabilityHistograms();
363 365
364 // Manager for the various in-flight logs. 366 // Manager for the various in-flight logs.
365 MetricsLogManager log_manager_; 367 MetricsLogManager log_manager_;
366 368
369 // Store of logs ready to be uploaded.
370 MetricsLogStore log_store_;
371
367 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. 372 // |histogram_snapshot_manager_| prepares histogram deltas for transmission.
368 base::HistogramSnapshotManager histogram_snapshot_manager_; 373 base::HistogramSnapshotManager histogram_snapshot_manager_;
369 374
370 // Used to manage various metrics reporting state prefs, such as client id, 375 // Used to manage various metrics reporting state prefs, such as client id,
371 // low entropy source and whether metrics reporting is enabled. Weak pointer. 376 // low entropy source and whether metrics reporting is enabled. Weak pointer.
372 MetricsStateManager* const state_manager_; 377 MetricsStateManager* const state_manager_;
373 378
374 // Used to interact with the embedder. Weak pointer; must outlive |this| 379 // Used to interact with the embedder. Weak pointer; must outlive |this|
375 // instance. 380 // instance.
376 MetricsServiceClient* const client_; 381 MetricsServiceClient* const client_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // Weak pointers factory used to post task on different threads. All weak 461 // Weak pointers factory used to post task on different threads. All weak
457 // pointers managed by this factory have the same lifetime as MetricsService. 462 // pointers managed by this factory have the same lifetime as MetricsService.
458 base::WeakPtrFactory<MetricsService> self_ptr_factory_; 463 base::WeakPtrFactory<MetricsService> self_ptr_factory_;
459 464
460 DISALLOW_COPY_AND_ASSIGN(MetricsService); 465 DISALLOW_COPY_AND_ASSIGN(MetricsService);
461 }; 466 };
462 467
463 } // namespace metrics 468 } // namespace metrics
464 469
465 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ 470 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « components/metrics/metrics_log_store_unittest.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698