diff options
author | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 11:27:06 +0000 |
---|---|---|
committer | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 11:27:06 +0000 |
commit | 334c59d927639aaae464f76b082a893b9fdf6987 (patch) | |
tree | f3e0a7ef15974751cbbbb32e2d075dc27088179f /chrome/common/json_pref_store.h | |
parent | c813df0195b2c96d2265ad767d4848dd13818211 (diff) | |
download | chromium_src-334c59d927639aaae464f76b082a893b9fdf6987.zip chromium_src-334c59d927639aaae464f76b082a893b9fdf6987.tar.gz chromium_src-334c59d927639aaae464f76b082a893b9fdf6987.tar.bz2 |
This CL implements alternative asynchronous methods for profile and preferences loading.
BUG=chromium-os:11104
TEST=UserProfileGotten (see "/tmp/login-times-sent") time doesn't increase, while UI jankness decreases.
Review URL: http://codereview.chromium.org/6716025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/json_pref_store.h')
-rw-r--r-- | chrome/common/json_pref_store.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/common/json_pref_store.h b/chrome/common/json_pref_store.h index b2a1f53..d8da37d 100644 --- a/chrome/common/json_pref_store.h +++ b/chrome/common/json_pref_store.h @@ -27,6 +27,11 @@ class Value; class JsonPrefStore : public PersistentPrefStore, public ImportantFileWriter::DataSerializer { public: + class Delegate { + public: + virtual void OnPrefsRead(PrefReadError error, bool no_dir) = 0; + }; + // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which // file I/O can be done. JsonPrefStore(const FilePath& pref_filename, @@ -46,11 +51,17 @@ class JsonPrefStore : public PersistentPrefStore, virtual void RemoveValue(const std::string& key); virtual bool ReadOnly() const; virtual PrefReadError ReadPrefs(); + // todo(altimofeev): move it to the PersistentPrefStore inteface. + void ReadPrefs(Delegate* delegate); virtual bool WritePrefs(); virtual void ScheduleWritePrefs(); virtual void CommitPendingWrite(); virtual void ReportValueChanged(const std::string& key); + // This method is called after JSON file has been read. Method takes + // ownership of the |value| pointer. + void OnFileRead(Value* value_owned, PrefReadError error, bool no_dir); + private: // ImportantFileWriter::DataSerializer overrides: virtual bool SerializeData(std::string* output); @@ -66,6 +77,8 @@ class JsonPrefStore : public PersistentPrefStore, ObserverList<PrefStore::Observer, true> observers_; + Delegate* delegate_; + DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); }; |