Replace deprecated base::NonThreadSafe in components/prefs in favor of SequenceChecker.
Note to crash team: This CL is a refactor and has no intended behavior change.
This change was scripted by https://crbug.com/676387#c8.
Note-worthy for the reviewer:
* SequenceChecker enforces thread-safety but not thread-affinity!
If the classes that were updated are thread-affine (use thread local
storage or a third-party API that does) they should be migrated to
ThreadChecker instead.
* ~NonThreadSafe() used to implcitly check in its destructor
~Sequence/ThreadChecker() doesn't by design. To keep this CL a
no-op, an explicit check was added to the destructor of migrated
classes.
* NonThreadSafe used to provide access to subclasses, as such
the |sequence_checker_| member was made protected rather than
private where necessary.
BUG=676387
This CL was uploaded by git cl split.
[email protected]
Review-Url: https://codereview.chromium.org/2908263002
Cr-Commit-Position: refs/heads/master@{#475963}
diff --git a/components/prefs/json_pref_store.h b/components/prefs/json_pref_store.h
index b298d30..90fde73 100644
--- a/components/prefs/json_pref_store.h
+++ b/components/prefs/json_pref_store.h
@@ -19,8 +19,8 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "base/sequence_checker.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"
@@ -48,8 +48,7 @@
class COMPONENTS_PREFS_EXPORT JsonPrefStore
: public PersistentPrefStore,
public base::ImportantFileWriter::DataSerializer,
- public base::SupportsWeakPtr<JsonPrefStore>,
- public base::NonThreadSafe {
+ public base::SupportsWeakPtr<JsonPrefStore> {
public:
struct ReadResult;
@@ -253,6 +252,8 @@
WriteCountHistogram write_count_histogram_;
+ SEQUENCE_CHECKER(sequence_checker_);
+
DISALLOW_COPY_AND_ASSIGN(JsonPrefStore);
};