summaryrefslogtreecommitdiffstats
path: root/base/prefs
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-22 15:56:40 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-22 15:56:40 +0000
commit5b7238f3b28df82e39b5b7d773a78e6e0f88f055 (patch)
tree594ba345d65858c742aff9d4035bf815226a538b /base/prefs
parent83904d3585a9762839463199808ae71d5062fbde (diff)
downloadchromium_src-5b7238f3b28df82e39b5b7d773a78e6e0f88f055.zip
chromium_src-5b7238f3b28df82e39b5b7d773a78e6e0f88f055.tar.gz
chromium_src-5b7238f3b28df82e39b5b7d773a78e6e0f88f055.tar.bz2
base/prefs: Make use of ThreadCheck in favor of less inheritance.
TEST=base_unittests --gtest_filter=*Prefs* R=mnissler@chromium.org,joi@chromium.org Review URL: https://chromiumcodereview.appspot.com/14393002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/prefs')
-rw-r--r--base/prefs/pref_notifier_impl.cc8
-rw-r--r--base/prefs/pref_notifier_impl.h7
2 files changed, 8 insertions, 7 deletions
diff --git a/base/prefs/pref_notifier_impl.cc b/base/prefs/pref_notifier_impl.cc
index 1fa495d..c02a7b3 100644
--- a/base/prefs/pref_notifier_impl.cc
+++ b/base/prefs/pref_notifier_impl.cc
@@ -17,7 +17,7 @@ PrefNotifierImpl::PrefNotifierImpl(PrefService* service)
}
PrefNotifierImpl::~PrefNotifierImpl() {
- DCHECK(CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
// Verify that there are no pref observers when we shut down.
for (PrefObserverMap::iterator it = pref_observers_.begin();
@@ -58,7 +58,7 @@ void PrefNotifierImpl::AddPrefObserver(const char* path,
void PrefNotifierImpl::RemovePrefObserver(const char* path,
PrefObserver* obs) {
- DCHECK(CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
const PrefObserverMap::iterator observer_iterator =
pref_observers_.find(path);
@@ -79,7 +79,7 @@ void PrefNotifierImpl::OnPreferenceChanged(const std::string& path) {
}
void PrefNotifierImpl::OnInitializationCompleted(bool succeeded) {
- DCHECK(CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
// We must make a copy of init_observers_ and clear it before we run
// observers, or we can end up in this method re-entrantly before
@@ -95,7 +95,7 @@ void PrefNotifierImpl::OnInitializationCompleted(bool succeeded) {
}
void PrefNotifierImpl::FireObservers(const std::string& path) {
- DCHECK(CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
// Only send notifications for registered preferences.
if (!pref_service_->FindPreference(path.c_str()))
diff --git a/base/prefs/pref_notifier_impl.h b/base/prefs/pref_notifier_impl.h
index 8e6f090..8f5120a 100644
--- a/base/prefs/pref_notifier_impl.h
+++ b/base/prefs/pref_notifier_impl.h
@@ -15,14 +15,13 @@
#include "base/prefs/base_prefs_export.h"
#include "base/prefs/pref_notifier.h"
#include "base/prefs/pref_observer.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
class PrefService;
// The PrefNotifier implementation used by the PrefService.
class BASE_PREFS_EXPORT PrefNotifierImpl
- : public NON_EXPORTED_BASE(PrefNotifier),
- public base::NonThreadSafe {
+ : public NON_EXPORTED_BASE(PrefNotifier) {
public:
PrefNotifierImpl();
explicit PrefNotifierImpl(PrefService* pref_service);
@@ -66,6 +65,8 @@ class BASE_PREFS_EXPORT PrefNotifierImpl
PrefObserverMap pref_observers_;
PrefInitObserverList init_observers_;
+ base::ThreadChecker thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl);
};