Commit c4f022a6 authored by gayane's avatar gayane Committed by Commit bot

Removed ScopedAllowIO from MetricsStateManager.

BUG=413783

Review URL: https://codereview.chromium.org/887843003

Cr-Commit-Position: refs/heads/master@{#315371}
parent bc321c76
...@@ -19,11 +19,19 @@ ...@@ -19,11 +19,19 @@
#include "components/metrics/metrics_service.h" #include "components/metrics/metrics_service.h"
#include "components/metrics/metrics_state_manager.h" #include "components/metrics/metrics_state_manager.h"
#include "components/rappor/rappor_service.h" #include "components/rappor/rappor_service.h"
#include "content/public/browser/browser_thread.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings.h"
#endif #endif
// Posts |GoogleUpdateSettings::StoreMetricsClientInfo| on blocking pool thread
// because it needs access to IO and cannot work from UI thread.
void PostStoreMetricsClientInfo(const metrics::ClientInfo& client_info) {
content::BrowserThread::GetBlockingPool()->PostTask(FROM_HERE,
base::Bind(&GoogleUpdateSettings::StoreMetricsClientInfo, client_info));
}
MetricsServicesManager::MetricsServicesManager(PrefService* local_state) MetricsServicesManager::MetricsServicesManager(PrefService* local_state)
: local_state_(local_state) { : local_state_(local_state) {
DCHECK(local_state); DCHECK(local_state);
...@@ -80,7 +88,7 @@ metrics::MetricsStateManager* MetricsServicesManager::GetMetricsStateManager() { ...@@ -80,7 +88,7 @@ metrics::MetricsStateManager* MetricsServicesManager::GetMetricsStateManager() {
local_state_, local_state_,
base::Bind(&MetricsServicesManager::IsMetricsReportingEnabled, base::Bind(&MetricsServicesManager::IsMetricsReportingEnabled,
base::Unretained(this)), base::Unretained(this)),
base::Bind(&GoogleUpdateSettings::StoreMetricsClientInfo), base::Bind(&PostStoreMetricsClientInfo),
base::Bind(&GoogleUpdateSettings::LoadMetricsClientInfo)); base::Bind(&GoogleUpdateSettings::LoadMetricsClientInfo));
} }
return metrics_state_manager_.get(); return metrics_state_manager_.get();
......
...@@ -28,9 +28,6 @@ struct ClientInfo { ...@@ -28,9 +28,6 @@ struct ClientInfo {
// The date on which metrics reporting was enabled: represented as an epoch // The date on which metrics reporting was enabled: represented as an epoch
// time in seconds. // time in seconds.
int64 reporting_enabled_date; int64 reporting_enabled_date;
private:
DISALLOW_COPY_AND_ASSIGN(ClientInfo);
}; };
} // namespace metrics } // namespace metrics
......
...@@ -219,9 +219,6 @@ void MetricsStateManager::RegisterPrefs(PrefRegistrySimple* registry) { ...@@ -219,9 +219,6 @@ void MetricsStateManager::RegisterPrefs(PrefRegistrySimple* registry) {
} }
void MetricsStateManager::BackUpCurrentClientInfo() { void MetricsStateManager::BackUpCurrentClientInfo() {
// TODO(gayane): Eliminate use of ScopedAllowIO. crbug.com/413783
base::ThreadRestrictions::ScopedAllowIO allow_io;
ClientInfo client_info; ClientInfo client_info;
client_info.client_id = client_id_; client_info.client_id = client_id_;
client_info.installation_date = local_state_->GetInt64(prefs::kInstallDate); client_info.installation_date = local_state_->GetInt64(prefs::kInstallDate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment