| Index: components/prefs/pref_service.cc
|
| diff --git a/components/prefs/pref_service.cc b/components/prefs/pref_service.cc
|
| index dccebf458a210c6ddc95eb23d5926f8834c24944..6abc09bcb46b56df74c3415279c2e6c7ef849b5a 100644
|
| --- a/components/prefs/pref_service.cc
|
| +++ b/components/prefs/pref_service.cc
|
| @@ -80,7 +80,7 @@ PrefService::PrefService(
|
| }
|
|
|
| PrefService::~PrefService() {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| // Reset pointers so accesses after destruction reliably crash.
|
| pref_value_store_.reset();
|
| @@ -104,17 +104,17 @@ void PrefService::InitFromStorage(bool async) {
|
| }
|
|
|
| void PrefService::CommitPendingWrite() {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| user_pref_store_->CommitPendingWrite();
|
| }
|
|
|
| void PrefService::SchedulePendingLossyWrites() {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| user_pref_store_->SchedulePendingLossyWrites();
|
| }
|
|
|
| bool PrefService::GetBoolean(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| bool result = false;
|
|
|
| @@ -129,7 +129,7 @@ bool PrefService::GetBoolean(const std::string& path) const {
|
| }
|
|
|
| int PrefService::GetInteger(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| int result = 0;
|
|
|
| @@ -144,7 +144,7 @@ int PrefService::GetInteger(const std::string& path) const {
|
| }
|
|
|
| double PrefService::GetDouble(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| double result = 0.0;
|
|
|
| @@ -159,7 +159,7 @@ double PrefService::GetDouble(const std::string& path) const {
|
| }
|
|
|
| std::string PrefService::GetString(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| std::string result;
|
|
|
| @@ -174,7 +174,7 @@ std::string PrefService::GetString(const std::string& path) const {
|
| }
|
|
|
| base::FilePath PrefService::GetFilePath(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| base::FilePath result;
|
|
|
| @@ -196,14 +196,14 @@ bool PrefService::HasPrefPath(const std::string& path) const {
|
| void PrefService::IteratePreferenceValues(
|
| base::RepeatingCallback<void(const std::string& key,
|
| const base::Value& value)> callback) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| for (const auto& it : *pref_registry_)
|
| callback.Run(it.first, *GetPreferenceValue(it.first));
|
| }
|
|
|
| std::unique_ptr<base::DictionaryValue> PrefService::GetPreferenceValues(
|
| IncludeDefaults include_defaults) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue);
|
| for (const auto& it : *pref_registry_) {
|
| if (include_defaults == INCLUDE_DEFAULTS) {
|
| @@ -220,7 +220,7 @@ std::unique_ptr<base::DictionaryValue> PrefService::GetPreferenceValues(
|
|
|
| const PrefService::Preference* PrefService::FindPreference(
|
| const std::string& pref_name) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| PreferenceMap::iterator it = prefs_map_.find(pref_name);
|
| if (it != prefs_map_.end())
|
| return &(it->second);
|
| @@ -271,7 +271,7 @@ bool PrefService::IsUserModifiablePreference(
|
|
|
| const base::DictionaryValue* PrefService::GetDictionary(
|
| const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const base::Value* value = GetPreferenceValue(path);
|
| if (!value) {
|
| @@ -287,7 +287,7 @@ const base::DictionaryValue* PrefService::GetDictionary(
|
|
|
| const base::Value* PrefService::GetUserPrefValue(
|
| const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const Preference* pref = FindPreference(path);
|
| if (!pref) {
|
| @@ -311,13 +311,13 @@ const base::Value* PrefService::GetUserPrefValue(
|
|
|
| void PrefService::SetDefaultPrefValue(const std::string& path,
|
| base::Value* value) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| pref_registry_->SetDefaultPrefValue(path, value);
|
| }
|
|
|
| const base::Value* PrefService::GetDefaultPrefValue(
|
| const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| // Lookup the preference in the default store.
|
| const base::Value* value = NULL;
|
| if (!pref_registry_->defaults()->GetValue(path, &value)) {
|
| @@ -328,7 +328,7 @@ const base::Value* PrefService::GetDefaultPrefValue(
|
| }
|
|
|
| const base::ListValue* PrefService::GetList(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const base::Value* value = GetPreferenceValue(path);
|
| if (!value) {
|
| @@ -360,7 +360,7 @@ PrefRegistry* PrefService::DeprecatedGetPrefRegistry() {
|
| }
|
|
|
| void PrefService::ClearPref(const std::string& path) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const Preference* pref = FindPreference(path);
|
| if (!pref) {
|
| @@ -405,7 +405,7 @@ void PrefService::SetInt64(const std::string& path, int64_t value) {
|
| }
|
|
|
| int64_t PrefService::GetInt64(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const base::Value* value = GetPreferenceValue(path);
|
| if (!value) {
|
| @@ -427,7 +427,7 @@ void PrefService::SetUint64(const std::string& path, uint64_t value) {
|
| }
|
|
|
| uint64_t PrefService::GetUint64(const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const base::Value* value = GetPreferenceValue(path);
|
| if (!value) {
|
| @@ -447,7 +447,7 @@ base::Value* PrefService::GetMutableUserPref(const std::string& path,
|
| base::Value::Type type) {
|
| CHECK(type == base::Value::Type::DICTIONARY ||
|
| type == base::Value::Type::LIST);
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const Preference* pref = FindPreference(path);
|
| if (!pref) {
|
| @@ -478,21 +478,21 @@ base::Value* PrefService::GetMutableUserPref(const std::string& path,
|
| }
|
|
|
| void PrefService::ReportUserPrefChanged(const std::string& key) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| user_pref_store_->ReportValueChanged(key, GetWriteFlags(FindPreference(key)));
|
| }
|
|
|
| void PrefService::ReportUserPrefChanged(
|
| const std::string& key,
|
| std::set<std::vector<std::string>> path_components) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| user_pref_store_->ReportSubValuesChanged(key, std::move(path_components),
|
| GetWriteFlags(FindPreference(key)));
|
| }
|
|
|
| void PrefService::SetUserPrefValue(const std::string& path,
|
| std::unique_ptr<base::Value> new_value) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| const Preference* pref = FindPreference(path);
|
| if (!pref) {
|
| @@ -596,7 +596,7 @@ bool PrefService::Preference::IsExtensionModifiable() const {
|
|
|
| const base::Value* PrefService::GetPreferenceValue(
|
| const std::string& path) const {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
| // TODO(battre): This is a check for crbug.com/435208. After analyzing some
|
| // crash dumps it looks like the PrefService is accessed even though it has
|
|
|