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

Side by Side Diff: base/prefs/json_pref_store.h

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Explicit Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 BASE_PREFS_JSON_PREF_STORE_H_ 5 #ifndef BASE_PREFS_JSON_PREF_STORE_H_
6 #define BASE_PREFS_JSON_PREF_STORE_H_ 6 #define BASE_PREFS_JSON_PREF_STORE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 26 matching lines...) Expand all
37 public base::ImportantFileWriter::DataSerializer, 37 public base::ImportantFileWriter::DataSerializer,
38 public base::SupportsWeakPtr<JsonPrefStore> { 38 public base::SupportsWeakPtr<JsonPrefStore> {
39 public: 39 public:
40 // Returns instance of SequencedTaskRunner which guarantees that file 40 // Returns instance of SequencedTaskRunner which guarantees that file
41 // operations on the same file will be executed in sequenced order. 41 // operations on the same file will be executed in sequenced order.
42 static scoped_refptr<base::SequencedTaskRunner> GetTaskRunnerForFile( 42 static scoped_refptr<base::SequencedTaskRunner> GetTaskRunnerForFile(
43 const base::FilePath& pref_filename, 43 const base::FilePath& pref_filename,
44 base::SequencedWorkerPool* worker_pool); 44 base::SequencedWorkerPool* worker_pool);
45 45
46 // Same as the constructor below with no alternate filename. 46 // Same as the constructor below with no alternate filename.
47 JsonPrefStore(const base::FilePath& pref_filename, 47 JsonPrefStore(
48 base::SequencedTaskRunner* sequenced_task_runner, 48 const base::FilePath& pref_filename,
49 scoped_ptr<PrefFilter> pref_filter); 49 const scoped_refptr<base::SequencedTaskRunner>& sequenced_task_runner,
50 scoped_ptr<PrefFilter> pref_filter);
50 51
51 // |sequenced_task_runner| must be a shutdown-blocking task runner, ideally 52 // |sequenced_task_runner| must be a shutdown-blocking task runner, ideally
52 // created by the GetTaskRunnerForFile() method above. 53 // created by the GetTaskRunnerForFile() method above.
53 // |pref_filename| is the path to the file to read prefs from. 54 // |pref_filename| is the path to the file to read prefs from.
54 // |pref_alternate_filename| is the path to an alternate file which the 55 // |pref_alternate_filename| is the path to an alternate file which the
55 // desired prefs may have previously been written to. If |pref_filename| 56 // desired prefs may have previously been written to. If |pref_filename|
56 // doesn't exist and |pref_alternate_filename| does, |pref_alternate_filename| 57 // doesn't exist and |pref_alternate_filename| does, |pref_alternate_filename|
57 // will be moved to |pref_filename| before the read occurs. 58 // will be moved to |pref_filename| before the read occurs.
58 JsonPrefStore(const base::FilePath& pref_filename, 59 JsonPrefStore(
59 const base::FilePath& pref_alternate_filename, 60 const base::FilePath& pref_filename,
60 base::SequencedTaskRunner* sequenced_task_runner, 61 const base::FilePath& pref_alternate_filename,
61 scoped_ptr<PrefFilter> pref_filter); 62 const scoped_refptr<base::SequencedTaskRunner>& sequenced_task_runner,
63 scoped_ptr<PrefFilter> pref_filter);
62 64
63 // PrefStore overrides: 65 // PrefStore overrides:
64 virtual bool GetValue(const std::string& key, 66 virtual bool GetValue(const std::string& key,
65 const base::Value** result) const OVERRIDE; 67 const base::Value** result) const OVERRIDE;
66 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; 68 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE;
67 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; 69 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE;
68 virtual bool HasObservers() const OVERRIDE; 70 virtual bool HasObservers() const OVERRIDE;
69 virtual bool IsInitializationComplete() const OVERRIDE; 71 virtual bool IsInitializationComplete() const OVERRIDE;
70 72
71 // PersistentPrefStore overrides: 73 // PersistentPrefStore overrides:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool initialized_; 147 bool initialized_;
146 bool filtering_in_progress_; 148 bool filtering_in_progress_;
147 PrefReadError read_error_; 149 PrefReadError read_error_;
148 150
149 std::set<std::string> keys_need_empty_value_; 151 std::set<std::string> keys_need_empty_value_;
150 152
151 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); 153 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore);
152 }; 154 };
153 155
154 #endif // BASE_PREFS_JSON_PREF_STORE_H_ 156 #endif // BASE_PREFS_JSON_PREF_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698