| Index: chrome/browser/metrics/metrics_log.cc
|
| diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
|
| index e64e254ffe72db8bd7e1d91394475f4bebd594c2..7a3089b80ea5ddfea106c0efa53c4da5bbe443fc 100644
|
| --- a/chrome/browser/metrics/metrics_log.cc
|
| +++ b/chrome/browser/metrics/metrics_log.cc
|
| @@ -402,11 +402,15 @@ static base::LazyInstance<std::string>::Leaky
|
|
|
| MetricsLog::MetricsLog(const std::string& client_id,
|
| int session_id,
|
| - LogType log_type)
|
| - : MetricsLogBase(client_id, session_id, log_type,
|
| + LogType log_type,
|
| + PrefService* local_state)
|
| + : MetricsLogBase(client_id,
|
| + session_id,
|
| + log_type,
|
| MetricsLog::GetVersionString()),
|
| creation_time_(base::TimeTicks::Now()),
|
| - extension_metrics_(uma_proto()->client_id()) {
|
| + extension_metrics_(uma_proto()->client_id()),
|
| + local_state_(local_state) {
|
| uma_proto()->mutable_system_profile()->set_channel(
|
| AsProtobufChannel(chrome::VersionInfo::GetChannel()));
|
|
|
| @@ -454,7 +458,7 @@ void MetricsLog::RecordStabilityMetrics(base::TimeDelta incremental_uptime,
|
| DCHECK(HasEnvironment());
|
| DCHECK(!HasStabilityMetrics());
|
|
|
| - PrefService* pref = GetPrefService();
|
| + PrefService* pref = local_state_;
|
| DCHECK(pref);
|
|
|
| // Get stability attributes out of Local State, zeroing out stored values.
|
| @@ -503,10 +507,6 @@ void MetricsLog::RecordStabilityMetrics(base::TimeDelta incremental_uptime,
|
| stability->set_debugger_not_present_count(debugger_not_present_count);
|
| }
|
|
|
| -PrefService* MetricsLog::GetPrefService() {
|
| - return g_browser_process->local_state();
|
| -}
|
| -
|
| gfx::Size MetricsLog::GetScreenSize() const {
|
| return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel();
|
| }
|
| @@ -701,14 +701,14 @@ void MetricsLog::RecordEnvironment(
|
| system_profile->set_brand_code(brand_code);
|
|
|
| int enabled_date;
|
| - bool success = base::StringToInt(GetMetricsEnabledDate(GetPrefService()),
|
| - &enabled_date);
|
| + bool success =
|
| + base::StringToInt(GetMetricsEnabledDate(local_state_), &enabled_date);
|
| DCHECK(success);
|
|
|
| // Reduce granularity of the enabled_date field to nearest hour.
|
| system_profile->set_uma_enabled_date(RoundSecondsToHour(enabled_date));
|
|
|
| - int64 install_date = GetPrefService()->GetInt64(prefs::kInstallDate);
|
| + int64 install_date = local_state_->GetInt64(prefs::kInstallDate);
|
|
|
| // Reduce granularity of the install_date field to nearest hour.
|
| system_profile->set_install_date(RoundSecondsToHour(install_date));
|
| @@ -799,7 +799,7 @@ void MetricsLog::RecordEnvironment(
|
| std::string base64_system_profile;
|
| if (system_profile->SerializeToString(&serialied_system_profile)) {
|
| base::Base64Encode(serialied_system_profile, &base64_system_profile);
|
| - PrefService* local_state = GetPrefService();
|
| + PrefService* local_state = local_state_;
|
| local_state->SetString(prefs::kStabilitySavedSystemProfile,
|
| base64_system_profile);
|
| local_state->SetString(prefs::kStabilitySavedSystemProfileHash,
|
| @@ -808,7 +808,7 @@ void MetricsLog::RecordEnvironment(
|
| }
|
|
|
| bool MetricsLog::LoadSavedEnvironmentFromPrefs() {
|
| - PrefService* local_state = GetPrefService();
|
| + PrefService* local_state = local_state_;
|
| const std::string base64_system_profile =
|
| local_state->GetString(prefs::kStabilitySavedSystemProfile);
|
| if (base64_system_profile.empty())
|
|
|