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

Unified Diff: chrome/browser/prefs/pref_hash_calculator.cc

Issue 231673002: Allow IO for the computation of PrefHashCalculator::legacy_device_id_instance_. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comment 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_hash_calculator.cc
diff --git a/chrome/browser/prefs/pref_hash_calculator.cc b/chrome/browser/prefs/pref_hash_calculator.cc
index 3fd951bcd237171ac5e783a51739b86eda49f58e..2f36018a11fd129e298cbf7a8f2fe219bf2f8054 100644
--- a/chrome/browser/prefs/pref_hash_calculator.cc
+++ b/chrome/browser/prefs/pref_hash_calculator.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "chrome/browser/prefs/tracked/pref_hash_calculator_helper.h"
#include "crypto/hmac.h"
@@ -137,6 +138,16 @@ PrefHashCalculator::ValidationResult PrefHashCalculator::Validate(
std::string PrefHashCalculator::RetrieveLegacyDeviceId() const {
if (!legacy_device_id_instance_) {
+ // Allow IO on this thread to retrieve the legacy device ID. The result of
+ // this operation is stored in |legacy_device_id_instance_| and will thus
+ // only happen at most once per PrefHashCalculator. This is not ideal, but
+ // this value is required synchronously to be able to continue loading prefs
+ // for this profile. This profile should then be migrated to a modern device
+ // ID and subsequent loads of this profile shouldn't need to run this code
+ // ever again.
+ // TODO(gab): Remove this when the legacy device ID (M33) becomes
+ // irrelevant.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
legacy_device_id_instance_.reset(
new std::string(GenerateDeviceIdLikePrefMetricsServiceDid(
get_legacy_device_id_callback_.Run(raw_device_id_))));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698