Chromium Code Reviews| Index: components/user_prefs/tracked/pref_hash_store_impl.cc |
| diff --git a/components/user_prefs/tracked/pref_hash_store_impl.cc b/components/user_prefs/tracked/pref_hash_store_impl.cc |
| index 80438d6954a45c9c791a2c7d620e108fdeff3141..6ba2c77a9a8450cfce9b6d7d4062f824300e52b7 100644 |
| --- a/components/user_prefs/tracked/pref_hash_store_impl.cc |
| +++ b/components/user_prefs/tracked/pref_hash_store_impl.cc |
| @@ -10,8 +10,22 @@ |
| #include "base/logging.h" |
| #include "base/macros.h" |
| #include "base/metrics/histogram.h" |
| +#include "components/user_prefs/tracked/device_id.h" |
| #include "components/user_prefs/tracked/hash_store_contents.h" |
| +namespace { |
| + |
| +// Returns a deterministic ID for this machine. |
| +std::string GenerateDeviceId() { |
|
proberge
2017/01/18 16:10:58
Possible optimization:
This method is called up t
gab
2017/01/19 18:52:05
Ah yes, that's a great idea let's do it. A static
proberge
2017/01/19 20:42:59
Done.
|
| + std::string device_id; |
| + if (GetDeterministicMachineSpecificId(&device_id) == MachineIdStatus::SUCCESS) |
|
proberge
2017/01/18 16:10:58
One thing I worry about is the stability of this m
gab
2017/01/19 18:52:05
It better be 100% deterministic and non-flaky. I'm
proberge
2017/01/19 20:42:59
Done.
|
| + return device_id; |
| + |
| + return std::string(); |
| +} |
| + |
| +} // namespace |
| + |
| class PrefHashStoreImpl::PrefHashStoreTransactionImpl |
| : public PrefHashStoreTransaction { |
| public: |
| @@ -49,10 +63,10 @@ class PrefHashStoreImpl::PrefHashStoreTransactionImpl |
| }; |
| PrefHashStoreImpl::PrefHashStoreImpl(const std::string& seed, |
| - const std::string& device_id, |
| + const std::string& legacy_device_id, |
| bool use_super_mac) |
| - : pref_hash_calculator_(seed, device_id), use_super_mac_(use_super_mac) { |
| -} |
| + : pref_hash_calculator_(seed, GenerateDeviceId(), legacy_device_id), |
| + use_super_mac_(use_super_mac) {} |
| PrefHashStoreImpl::~PrefHashStoreImpl() { |
| } |