Chromium Code Reviews| Index: base/prefs/json_pref_store.h |
| diff --git a/base/prefs/json_pref_store.h b/base/prefs/json_pref_store.h |
| index 6ceea6885487a0c73c2910312de60eee7a25a099..6df9e239b11cdc9a7c6b18a9196c4a8d90d76d5e 100644 |
| --- a/base/prefs/json_pref_store.h |
| +++ b/base/prefs/json_pref_store.h |
| @@ -19,6 +19,7 @@ |
| #include "base/observer_list.h" |
| #include "base/prefs/base_prefs_export.h" |
| #include "base/prefs/persistent_pref_store.h" |
| +#include "base/threading/non_thread_safe.h" |
| class PrefFilter; |
| @@ -30,13 +31,15 @@ class SequencedWorkerPool; |
| class Value; |
| } |
| - |
| // A writable PrefStore implementation that is used for user preferences. |
| class BASE_PREFS_EXPORT JsonPrefStore |
| : public PersistentPrefStore, |
| public base::ImportantFileWriter::DataSerializer, |
| - public base::SupportsWeakPtr<JsonPrefStore> { |
| + public base::SupportsWeakPtr<JsonPrefStore>, |
| + public base::NonThreadSafe { |
| public: |
| + struct ReadResult; |
|
Bernhard Bauer
2014/07/22 16:22:00
I think the struct can be private?
gab
2014/07/22 16:47:43
No because it's used by the anonymous methods in t
Bernhard Bauer
2014/07/22 16:56:35
Yeah... one possibility would be to make ReadPrefs
gab
2014/07/22 17:23:05
Yea, I debated both and figured the public fwd-dec
|
| + |
| // Returns instance of SequencedTaskRunner which guarantees that file |
| // operations on the same file will be executed in sequenced order. |
| static scoped_refptr<base::SequencedTaskRunner> GetTaskRunnerForFile( |
| @@ -94,23 +97,16 @@ class BASE_PREFS_EXPORT JsonPrefStore |
| void RegisterOnNextSuccessfulWriteCallback( |
| const base::Closure& on_next_successful_write); |
| + private: |
| + virtual ~JsonPrefStore(); |
| + |
| // This method is called after the JSON file has been read. It then hands |
| // |value| (or an empty dictionary in some read error cases) to the |
| // |pref_filter| if one is set. It also gives a callback pointing at |
| // FinalizeFileRead() to that |pref_filter_| which is then responsible for |
| // invoking it when done. If there is no |pref_filter_|, FinalizeFileRead() |
| // is invoked directly. |
| - // Note, this method is used with asynchronous file reading, so this class |
| - // exposes it only for the internal needs (read: do not call it manually). |
| - // TODO(gab): Move this method to the private section and hand a callback to |
| - // it to FileThreadDeserializer rather than exposing this public method and |
| - // giving a JsonPrefStore* to FileThreadDeserializer. |
| - void OnFileRead(scoped_ptr<base::Value> value, |
| - PrefReadError error, |
| - bool no_dir); |
| - |
| - private: |
| - virtual ~JsonPrefStore(); |
| + void OnFileRead(scoped_ptr<ReadResult> read_result); |
| // ImportantFileWriter::DataSerializer overrides: |
| virtual bool SerializeData(std::string* output) OVERRIDE; |