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

Unified Diff: chrome/browser/metrics/metrics_service.h

Issue 256143006: Refactor MetricsStateManager class out of MetricsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_service.h
===================================================================
--- chrome/browser/metrics/metrics_service.h (revision 266649)
+++ chrome/browser/metrics/metrics_service.h (working copy)
@@ -70,6 +70,7 @@
namespace metrics {
class ClonedInstallDetector;
+class MetricsStateManager;
}
namespace net {
@@ -140,13 +141,17 @@
// 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);
+ void InitializeMetricsRecordingState();
// 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.
void Start();
+ // If metrics reporting is enabled, starts the metrics service. Returns
+ // whether the metrics service was started.
+ bool StartIfMetricsReportingEnabled();
+
// Starts the metrics system in a special test-only mode. Metrics won't ever
// be uploaded or persisted in this mode, but metrics will be recorded in
// memory.
@@ -180,8 +185,7 @@
// Note that this reporting state can not be checked by reporting_active()
// because this method may need to be called before the MetricsService needs
// to be started.
- scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(
- ReportingState reporting_state);
+ scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider();
// Force the client ID to be generated. This is useful in case it's needed
// before recording.
@@ -368,22 +372,6 @@
base::TimeDelta* incremental_uptime,
base::TimeDelta* uptime);
- // Reset the client id and low entropy source if the kMetricsResetMetricIDs
- // pref is true.
- void ResetMetricsIDsIfNecessary();
-
- // Returns the low entropy source for this client. This is a random value
- // that is non-identifying amongst browser clients. This method will
- // generate the entropy source value if it has not been called before.
- int GetLowEntropySource();
-
- // Returns the first entropy source that was returned by this service since
- // start up, or NONE if neither was returned yet. This is exposed for testing
- // only.
- EntropySourceReturned entropy_source_returned() const {
- return entropy_source_returned_;
- }
-
// Turns recording on or off.
// DisableRecording() also forces a persistent save of logging state (if
// anything has been recorded, or transmitted).
@@ -397,11 +385,8 @@
void HandleIdleSinceLastTransmission(bool in_idle);
// Set up client ID, session ID, etc.
- void InitializeMetricsState(ReportingState reporting_state);
+ void InitializeMetricsState();
- // Generates a new client ID to use to identify self to metrics server.
- static std::string GenerateClientID();
-
// Schedule the next save of LocalState information. This is called
// automatically by the task that performs each save to schedule the next one.
void ScheduleNextStateSave();
@@ -512,6 +497,8 @@
void GetCurrentSyntheticFieldTrials(
std::vector<chrome_variations::ActiveGroupId>* synthetic_trials);
+ scoped_ptr<metrics::MetricsStateManager> state_manager_;
+
base::ActionCallback action_callback_;
content::NotificationRegistrar registrar_;
@@ -563,12 +550,6 @@
// The HTTP pipelining test server.
std::string http_pipelining_test_server_;
- // The identifier that's sent to the server with the log reports.
- std::string client_id_;
-
- // The non-identifying low entropy source value.
- int low_entropy_source_;
-
// Whether the MetricsService object has received any notifications since
// the last time a transmission was sent.
bool idle_since_last_transmission_;
@@ -609,9 +590,6 @@
scoped_refptr<chromeos::ExternalMetrics> external_metrics_;
#endif
- // The last entropy source returned by this service, used for testing.
- EntropySourceReturned entropy_source_returned_;
-
// Stores the time of the first call to |GetUptimes()|.
base::TimeTicks first_updated_time_;
@@ -628,19 +606,10 @@
// Field trial groups that map to Chrome configuration states.
SyntheticTrialGroups synthetic_trial_groups_;
- scoped_ptr<metrics::ClonedInstallDetector> cloned_install_detector_;
-
- FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted);
FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess);
- FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, LowEntropySource0NotReset);
FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest,
PermutedEntropyCacheClearedWhenLowEntropyReset);
FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial);
- FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ResetMetricsIDs);
- FRIEND_TEST_ALL_PREFIXES(MetricsServiceBrowserTest,
- CheckLowEntropySourceUsed);
- FRIEND_TEST_ALL_PREFIXES(MetricsServiceReportingTest,
- CheckHighEntropySourceUsed);
DISALLOW_COPY_AND_ASSIGN(MetricsService);
};

Powered by Google App Engine
This is Rietveld 408576698