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

Unified Diff: base/prefs/json_pref_store.h

Issue 400673008: Get rid of FileThreadDeserializer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: inline PostTaskAndReplyWithResult 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/prefs/json_pref_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+
// 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;
« no previous file with comments | « no previous file | base/prefs/json_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698