OLD | NEW |
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 #include "components/metrics/metrics_state_manager.h" | 5 #include "components/metrics/metrics_state_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ClonedInstallDetector::RegisterPrefs(registry); | 212 ClonedInstallDetector::RegisterPrefs(registry); |
213 CachingPermutedEntropyProvider::RegisterPrefs(registry); | 213 CachingPermutedEntropyProvider::RegisterPrefs(registry); |
214 | 214 |
215 // TODO(asvitkine): Remove these once a couple of releases have passed. | 215 // TODO(asvitkine): Remove these once a couple of releases have passed. |
216 // http://crbug.com/357704 | 216 // http://crbug.com/357704 |
217 registry->RegisterStringPref(prefs::kMetricsOldClientID, std::string()); | 217 registry->RegisterStringPref(prefs::kMetricsOldClientID, std::string()); |
218 registry->RegisterIntegerPref(prefs::kMetricsOldLowEntropySource, 0); | 218 registry->RegisterIntegerPref(prefs::kMetricsOldLowEntropySource, 0); |
219 } | 219 } |
220 | 220 |
221 void MetricsStateManager::BackUpCurrentClientInfo() { | 221 void MetricsStateManager::BackUpCurrentClientInfo() { |
222 // TODO(gayane): Eliminate use of ScopedAllowIO. crbug.com/413783 | |
223 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
224 | |
225 ClientInfo client_info; | 222 ClientInfo client_info; |
226 client_info.client_id = client_id_; | 223 client_info.client_id = client_id_; |
227 client_info.installation_date = local_state_->GetInt64(prefs::kInstallDate); | 224 client_info.installation_date = local_state_->GetInt64(prefs::kInstallDate); |
228 client_info.reporting_enabled_date = | 225 client_info.reporting_enabled_date = |
229 local_state_->GetInt64(prefs::kMetricsReportingEnabledTimestamp); | 226 local_state_->GetInt64(prefs::kMetricsReportingEnabledTimestamp); |
230 store_client_info_.Run(client_info); | 227 store_client_info_.Run(client_info); |
231 } | 228 } |
232 | 229 |
233 scoped_ptr<ClientInfo> MetricsStateManager::LoadClientInfoAndMaybeMigrate() { | 230 scoped_ptr<ClientInfo> MetricsStateManager::LoadClientInfoAndMaybeMigrate() { |
234 scoped_ptr<ClientInfo> client_info = load_client_info_.Run(); | 231 scoped_ptr<ClientInfo> client_info = load_client_info_.Run(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 303 |
307 local_state_->ClearPref(prefs::kMetricsClientID); | 304 local_state_->ClearPref(prefs::kMetricsClientID); |
308 local_state_->ClearPref(prefs::kMetricsLowEntropySource); | 305 local_state_->ClearPref(prefs::kMetricsLowEntropySource); |
309 local_state_->ClearPref(prefs::kMetricsResetIds); | 306 local_state_->ClearPref(prefs::kMetricsResetIds); |
310 | 307 |
311 // Also clear the backed up client info. | 308 // Also clear the backed up client info. |
312 store_client_info_.Run(ClientInfo()); | 309 store_client_info_.Run(ClientInfo()); |
313 } | 310 } |
314 | 311 |
315 } // namespace metrics | 312 } // namespace metrics |
OLD | NEW |