From 24f81cad13af6e0ba08ac2335cb27ad280f1143e Mon Sep 17 00:00:00 2001 From: "blundell@chromium.org" Date: Mon, 26 May 2014 15:59:34 +0000 Subject: Remove dependencies of Metrics{Service,Log} on g_browser_process->local_state() This CL changes MetricsService and MetricsLog to take in a |local_state| param in their constructors. It additionally changes several static MetricsService functions to take in a |local_state| param. BUG=374299,374300 TBR=jochen Review URL: https://codereview.chromium.org/282093012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272833 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/metrics/metrics_log.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'chrome/browser/metrics/metrics_log.h') diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h index 25102d8..0e7c8f9 100644 --- a/chrome/browser/metrics/metrics_log.h +++ b/chrome/browser/metrics/metrics_log.h @@ -45,13 +45,15 @@ class MetricsLog : public metrics::MetricsLogBase { // |client_id| is the identifier for this profile on this installation // |session_id| is an integer that's incremented on each application launch // |client| is used to interact with the embedder. + // |local_state| is the PrefService that this instance should use. // Note: |this| instance does not take ownership of the |client|, but rather // stores a weak pointer to it. The caller should ensure that the |client| is // valid for the lifetime of this class. MetricsLog(const std::string& client_id, int session_id, LogType log_type, - metrics::MetricsServiceClient* client); + metrics::MetricsServiceClient* client, + PrefService* local_state); virtual ~MetricsLog(); // Records the current operating environment, including metrics provided by @@ -101,9 +103,6 @@ class MetricsLog : public metrics::MetricsLogBase { protected: // Exposed for the sake of mocking in test code. - // Returns the PrefService from which to log metrics data. - virtual PrefService* GetPrefService(); - // Fills |field_trial_ids| with the list of initialized field trials name and // group ids. virtual void GetFieldTrialIds( @@ -138,6 +137,8 @@ class MetricsLog : public metrics::MetricsLogBase { // The time when the current log was created. const base::TimeTicks creation_time_; + PrefService* local_state_; + DISALLOW_COPY_AND_ASSIGN(MetricsLog); }; -- cgit v1.1