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

Side by Side Diff: services/preferences/tracked/registry_hash_store_contents_win.h

Issue 2937633003: Revert of Fix a race condition in ~RegistryHashStoreContentsWin (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | services/preferences/tracked/registry_hash_store_contents_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef SERVICES_PREFERENCES_TRACKED_REGISTRY_HASH_STORE_CONTENTS_WIN_H_ 5 #ifndef SERVICES_PREFERENCES_TRACKED_REGISTRY_HASH_STORE_CONTENTS_WIN_H_
6 #define SERVICES_PREFERENCES_TRACKED_REGISTRY_HASH_STORE_CONTENTS_WIN_H_ 6 #define SERVICES_PREFERENCES_TRACKED_REGISTRY_HASH_STORE_CONTENTS_WIN_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "services/preferences/tracked/hash_store_contents.h" 10 #include "services/preferences/tracked/hash_store_contents.h"
11 #include "services/preferences/tracked/temp_scoped_dir_cleaner.h"
12
13 // Helper object to clear registry entries for scoped temporary pref stores.
14 class TempScopedDirRegistryCleaner : public TempScopedDirCleaner {
15 public:
16 void SetRegistryPath(const base::string16& registry_path);
17
18 private:
19 friend class base::RefCountedThreadSafe<TempScopedDirRegistryCleaner>;
20 ~TempScopedDirRegistryCleaner() override;
21
22 base::string16 registry_path_;
23 };
24 11
25 // Implements HashStoreContents by storing MACs in the Windows registry. 12 // Implements HashStoreContents by storing MACs in the Windows registry.
26 class RegistryHashStoreContentsWin : public HashStoreContents { 13 class RegistryHashStoreContentsWin : public HashStoreContents {
27 public: 14 public:
28 // Constructs a RegistryHashStoreContents which acts on a registry entry 15 // Constructs a RegistryHashStoreContents which acts on a registry entry
29 // defined by |registry_path| and |store_key|. 16 // defined by |registry_path| and |store_key|. If |store_key| begins with
30 explicit RegistryHashStoreContentsWin( 17 // base::ScopedTempDir::GetTempDirPrefix(), this RegistryHashStoreContentsWin
31 const base::string16& registry_path, 18 // will self Reset() on destruction to avoid proliferating keys in tests that
32 const base::string16& store_key, 19 // create a profile in a ScopedTempDir (https://crbug.com/721245).
33 scoped_refptr<TempScopedDirCleaner> temp_dir_cleaner); 20 explicit RegistryHashStoreContentsWin(const base::string16& registry_path,
21 const base::string16& store_key);
22
34 ~RegistryHashStoreContentsWin() override; 23 ~RegistryHashStoreContentsWin() override;
35 24
36 // HashStoreContents overrides: 25 // HashStoreContents overrides:
37 bool IsCopyable() const override; 26 bool IsCopyable() const override;
38 std::unique_ptr<HashStoreContents> MakeCopy() const override; 27 std::unique_ptr<HashStoreContents> MakeCopy() const override;
39 base::StringPiece GetUMASuffix() const override; 28 base::StringPiece GetUMASuffix() const override;
40 void Reset() override; 29 void Reset() override;
41 bool GetMac(const std::string& path, std::string* out_value) override; 30 bool GetMac(const std::string& path, std::string* out_value) override;
42 bool GetSplitMacs(const std::string& path, 31 bool GetSplitMacs(const std::string& path,
43 std::map<std::string, std::string>* split_macs) override; 32 std::map<std::string, std::string>* split_macs) override;
44 void SetMac(const std::string& path, const std::string& value) override; 33 void SetMac(const std::string& path, const std::string& value) override;
45 void SetSplitMac(const std::string& path, 34 void SetSplitMac(const std::string& path,
46 const std::string& split_path, 35 const std::string& split_path,
47 const std::string& value) override; 36 const std::string& value) override;
48 bool RemoveEntry(const std::string& path) override; 37 bool RemoveEntry(const std::string& path) override;
49 38
50 // Unsupported HashStoreContents overrides: 39 // Unsupported HashStoreContents overrides:
51 void ImportEntry(const std::string& path, 40 void ImportEntry(const std::string& path,
52 const base::Value* in_value) override; 41 const base::Value* in_value) override;
53 const base::DictionaryValue* GetContents() const override; 42 const base::DictionaryValue* GetContents() const override;
54 std::string GetSuperMac() const override; 43 std::string GetSuperMac() const override;
55 void SetSuperMac(const std::string& super_mac) override; 44 void SetSuperMac(const std::string& super_mac) override;
56 45
57 private: 46 private:
58 // Helper constructor for |MakeCopy|. 47 // Helper constructor for |MakeCopy|.
59 explicit RegistryHashStoreContentsWin( 48 explicit RegistryHashStoreContentsWin(
60 const RegistryHashStoreContentsWin& other); 49 const RegistryHashStoreContentsWin& other);
61 50
62 const base::string16 preference_key_name_; 51 const base::string16 preference_key_name_;
63 scoped_refptr<TempScopedDirCleaner> temp_dir_cleaner_; 52 const bool reset_on_delete_;
64 }; 53 };
65 54
66 #endif // SERVICES_PREFERENCES_TRACKED_REGISTRY_HASH_STORE_CONTENTS_WIN_H_ 55 #endif // SERVICES_PREFERENCES_TRACKED_REGISTRY_HASH_STORE_CONTENTS_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | services/preferences/tracked/registry_hash_store_contents_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698