Added CallOnValidThread to PrefNotifierImpl::AddPrefObserver

Bug: 1028765
Change-Id: Idb5c2a62183eb4de22a8ca9fc81f897e0d0beecf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943169
Commit-Queue: Gabriel Charette <[email protected]>
Auto-Submit: Dominic Battré <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#720252}
diff --git a/components/prefs/pref_notifier_impl.cc b/components/prefs/pref_notifier_impl.cc
index 9c753e71..33eb9e9 100644
--- a/components/prefs/pref_notifier_impl.cc
+++ b/components/prefs/pref_notifier_impl.cc
@@ -66,6 +66,8 @@
 
 void PrefNotifierImpl::AddPrefObserver(const std::string& path,
                                        PrefObserver* obs) {
+  DCHECK(thread_checker_.CalledOnValidThread());
+
   // Get the pref observer list associated with the path.
   PrefObserverList* observer_list = nullptr;
   auto observer_iterator = pref_observers_.find(path);