Index: components/prefs/json_pref_store.h |
diff --git a/components/prefs/json_pref_store.h b/components/prefs/json_pref_store.h |
index 6284b8d5478df39110f532e564d76e44bffc3e3d..b298d30e6915cfa68a12dcd5bf5d6f6b0bfcef5f 100644 |
--- a/components/prefs/json_pref_store.h |
+++ b/components/prefs/json_pref_store.h |
@@ -19,9 +19,11 @@ |
#include "base/macros.h" |
#include "base/memory/weak_ptr.h" |
#include "base/observer_list.h" |
+#include "base/task_scheduler/post_task.h" |
#include "base/threading/non_thread_safe.h" |
#include "components/prefs/base_prefs_export.h" |
#include "components/prefs/persistent_pref_store.h" |
+#include "components/prefs/pref_filter.h" |
class PrefFilter; |
@@ -62,13 +64,18 @@ class COMPONENTS_PREFS_EXPORT JsonPrefStore |
const base::FilePath& pref_filename, |
base::SequencedWorkerPool* worker_pool); |
- // |sequenced_task_runner| must be a shutdown-blocking task runner, ideally |
- // created by the GetTaskRunnerForFile() method above. |
- // |pref_filename| is the path to the file to read prefs from. |
- JsonPrefStore( |
- const base::FilePath& pref_filename, |
- const scoped_refptr<base::SequencedTaskRunner>& sequenced_task_runner, |
- std::unique_ptr<PrefFilter> pref_filter); |
+ // |pref_filename| is the path to the file to read prefs from. It is incorrect |
+ // to create multiple JsonPrefStore with the same |pref_filename|. |
+ // |sequenced_task_runner| is used for asynchronous reads and writes. It must |
+ // have the base::TaskShutdownBehavior::BLOCK_SHUTDOWN and base::MayBlock() |
+ // traits. Unless external tasks need to run on the same sequence as |
+ // JsonPrefStore tasks, keep the default value. |
+ JsonPrefStore(const base::FilePath& pref_filename, |
+ scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
+ base::CreateSequencedTaskRunnerWithTraits( |
+ {base::MayBlock(), |
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN}), |
+ std::unique_ptr<PrefFilter> pref_filter = nullptr); |
// PrefStore overrides: |
bool GetValue(const std::string& key, |