| Index: services/preferences/tracked/registry_hash_store_contents_win.cc
|
| diff --git a/services/preferences/tracked/registry_hash_store_contents_win.cc b/services/preferences/tracked/registry_hash_store_contents_win.cc
|
| index 76ee57f3cd1caa8aef225a751e17b6578fac7985..a3a123d541d242116dc97f281dfb0fc9b9d48c89 100644
|
| --- a/services/preferences/tracked/registry_hash_store_contents_win.cc
|
| +++ b/services/preferences/tracked/registry_hash_store_contents_win.cc
|
| @@ -74,18 +74,30 @@ RegistryHashStoreContentsWin::RegistryHashStoreContentsWin(
|
| const base::string16& registry_path,
|
| const base::string16& store_key)
|
| : preference_key_name_(registry_path + L"\\PreferenceMACs\\" + store_key),
|
| - reset_on_delete_(base::StartsWith(store_key,
|
| - base::ScopedTempDir::GetTempDirPrefix(),
|
| - base::CompareCase::INSENSITIVE_ASCII)) {
|
| -}
|
| + reset_on_delete_(false),
|
| + is_for_test_scoped_dir_(
|
| + base::StartsWith(store_key,
|
| + base::ScopedTempDir::GetTempDirPrefix(),
|
| + base::CompareCase::INSENSITIVE_ASCII)) {}
|
|
|
| RegistryHashStoreContentsWin::~RegistryHashStoreContentsWin() {
|
| if (reset_on_delete_)
|
| Reset();
|
| }
|
|
|
| +// To properly write to the Windows registry when Chrome is shutting down,
|
| +// a clone of this object is created and passed to a callback which will be
|
| +// run on a different thread. This could create a race condition if both the
|
| +// orignal and clone are destroyed (and try to delete the registry key) at
|
| +// the same time: only the clone should attempt to delete the registry key.
|
| +// Note that this only applies for scoped temporary profiles used in tests.
|
| RegistryHashStoreContentsWin::RegistryHashStoreContentsWin(
|
| - const RegistryHashStoreContentsWin& other) = default;
|
| + const RegistryHashStoreContentsWin& other)
|
| + : preference_key_name_(other.preference_key_name_),
|
| + reset_on_delete_(other.is_for_test_scoped_dir_),
|
| + is_for_test_scoped_dir_(other.is_for_test_scoped_dir_) {
|
| + DCHECK(!other.reset_on_delete_);
|
| +};
|
|
|
| bool RegistryHashStoreContentsWin::IsCopyable() const {
|
| return true;
|
|
|