diff options
author | caitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-26 22:01:39 +0000 |
---|---|---|
committer | caitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-26 22:01:39 +0000 |
commit | 14e0ec68b68a548cf44506b425e485ecb0c5ab2d (patch) | |
tree | 61153fe334f8452e96275a810243bc79a594a3d6 | |
parent | 08d403c065377c358a93eb07a8b935d72b3b970b (diff) | |
download | chromium_src-14e0ec68b68a548cf44506b425e485ecb0c5ab2d.zip chromium_src-14e0ec68b68a548cf44506b425e485ecb0c5ab2d.tar.gz chromium_src-14e0ec68b68a548cf44506b425e485ecb0c5ab2d.tar.bz2 |
Switch prefs to use ObserverList::might_have_observers instead of ObserverList::size.
See issue for rationale behind this change.
BUG=278526
TEST=no change
TBR=benm@chromium.org
(TBR'ing for prefs API change).
Review URL: https://chromiumcodereview.appspot.com/22986034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219622 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | android_webview/browser/aw_pref_store.cc | 4 | ||||
-rw-r--r-- | android_webview/browser/aw_pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/default_pref_store.cc | 4 | ||||
-rw-r--r-- | base/prefs/default_pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/json_pref_store.cc | 4 | ||||
-rw-r--r-- | base/prefs/json_pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/overlay_user_pref_store.cc | 4 | ||||
-rw-r--r-- | base/prefs/overlay_user_pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/pref_store.cc | 4 | ||||
-rw-r--r-- | base/prefs/pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/pref_value_store.cc | 2 | ||||
-rw-r--r-- | base/prefs/testing_pref_store.cc | 4 | ||||
-rw-r--r-- | base/prefs/testing_pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/value_map_pref_store.cc | 4 | ||||
-rw-r--r-- | base/prefs/value_map_pref_store.h | 2 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 4 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.h | 2 |
17 files changed, 25 insertions, 25 deletions
diff --git a/android_webview/browser/aw_pref_store.cc b/android_webview/browser/aw_pref_store.cc index 613a847..0720ee9 100644 --- a/android_webview/browser/aw_pref_store.cc +++ b/android_webview/browser/aw_pref_store.cc @@ -29,8 +29,8 @@ void AwPrefStore::RemoveObserver(PrefStore::Observer* observer) { observers_.RemoveObserver(observer); } -size_t AwPrefStore::NumberOfObservers() const { - return observers_.size(); +bool AwPrefStore::HasObservers() const { + return observers_.might_have_observers(); } bool AwPrefStore::IsInitializationComplete() const { diff --git a/android_webview/browser/aw_pref_store.h b/android_webview/browser/aw_pref_store.h index e636e1b..8581a03 100644 --- a/android_webview/browser/aw_pref_store.h +++ b/android_webview/browser/aw_pref_store.h @@ -26,7 +26,7 @@ class AwPrefStore : public PersistentPrefStore { const base::Value** result) const OVERRIDE; virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; virtual bool IsInitializationComplete() const OVERRIDE; // PersistentPrefStore overrides: diff --git a/base/prefs/default_pref_store.cc b/base/prefs/default_pref_store.cc index babb4d5..92abba1 100644 --- a/base/prefs/default_pref_store.cc +++ b/base/prefs/default_pref_store.cc @@ -22,8 +22,8 @@ void DefaultPrefStore::RemoveObserver(PrefStore::Observer* observer) { observers_.RemoveObserver(observer); } -size_t DefaultPrefStore::NumberOfObservers() const { - return observers_.size(); +bool DefaultPrefStore::HasObservers() const { + return observers_.might_have_observers(); } void DefaultPrefStore::SetDefaultValue(const std::string& key, diff --git a/base/prefs/default_pref_store.h b/base/prefs/default_pref_store.h index 97b3960..23b9096 100644 --- a/base/prefs/default_pref_store.h +++ b/base/prefs/default_pref_store.h @@ -25,7 +25,7 @@ class BASE_PREFS_EXPORT DefaultPrefStore : public PrefStore { const base::Value** result) const OVERRIDE; virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; // Sets a |value| for |key|. Should only be called if a value has not been // set yet; otherwise call ReplaceDefaultValue(). diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc index 0b93f74..e230407 100644 --- a/base/prefs/json_pref_store.cc +++ b/base/prefs/json_pref_store.cc @@ -179,8 +179,8 @@ void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { observers_.RemoveObserver(observer); } -size_t JsonPrefStore::NumberOfObservers() const { - return observers_.size(); +bool JsonPrefStore::HasObservers() const { + return observers_.might_have_observers(); } bool JsonPrefStore::IsInitializationComplete() const { diff --git a/base/prefs/json_pref_store.h b/base/prefs/json_pref_store.h index 738b917..9e6c182 100644 --- a/base/prefs/json_pref_store.h +++ b/base/prefs/json_pref_store.h @@ -48,7 +48,7 @@ class BASE_PREFS_EXPORT JsonPrefStore const base::Value** result) const OVERRIDE; virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; virtual bool IsInitializationComplete() const OVERRIDE; // PersistentPrefStore overrides: diff --git a/base/prefs/overlay_user_pref_store.cc b/base/prefs/overlay_user_pref_store.cc index 628d3b4..47668cc 100644 --- a/base/prefs/overlay_user_pref_store.cc +++ b/base/prefs/overlay_user_pref_store.cc @@ -25,8 +25,8 @@ void OverlayUserPrefStore::RemoveObserver(PrefStore::Observer* observer) { observers_.RemoveObserver(observer); } -size_t OverlayUserPrefStore::NumberOfObservers() const { - return observers_.size(); +bool OverlayUserPrefStore::HasObservers() const { + return observers_.might_have_observers(); } bool OverlayUserPrefStore::IsInitializationComplete() const { diff --git a/base/prefs/overlay_user_pref_store.h b/base/prefs/overlay_user_pref_store.h index 120d405..1895ac0 100644 --- a/base/prefs/overlay_user_pref_store.h +++ b/base/prefs/overlay_user_pref_store.h @@ -32,7 +32,7 @@ class BASE_PREFS_EXPORT OverlayUserPrefStore : public PersistentPrefStore, // Methods of PrefStore. virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; virtual bool IsInitializationComplete() const OVERRIDE; virtual bool GetValue(const std::string& key, const base::Value** result) const OVERRIDE; diff --git a/base/prefs/pref_store.cc b/base/prefs/pref_store.cc index 0521654..f286a33 100644 --- a/base/prefs/pref_store.cc +++ b/base/prefs/pref_store.cc @@ -4,8 +4,8 @@ #include "base/prefs/pref_store.h" -size_t PrefStore::NumberOfObservers() const { - return 0; +bool PrefStore::HasObservers() const { + return false; } bool PrefStore::IsInitializationComplete() const { diff --git a/base/prefs/pref_store.h b/base/prefs/pref_store.h index 2239528..b736ac3 100644 --- a/base/prefs/pref_store.h +++ b/base/prefs/pref_store.h @@ -41,7 +41,7 @@ class BASE_PREFS_EXPORT PrefStore : public base::RefCounted<PrefStore> { // Add and remove observers. virtual void AddObserver(Observer* observer) {} virtual void RemoveObserver(Observer* observer) {} - virtual size_t NumberOfObservers() const; + virtual bool HasObservers() const; // Whether the store has completed all asynchronous initialization. virtual bool IsInitializationComplete() const; diff --git a/base/prefs/pref_value_store.cc b/base/prefs/pref_value_store.cc index 7d54f09..96e9ea3 100644 --- a/base/prefs/pref_value_store.cc +++ b/base/prefs/pref_value_store.cc @@ -27,7 +27,7 @@ void PrefValueStore::PrefStoreKeeper::Initialize( PrefValueStore::PrefStoreType type) { if (pref_store_.get()) { pref_store_->RemoveObserver(this); - DCHECK_EQ(0U, pref_store_->NumberOfObservers()); + DCHECK(!pref_store_->HasObservers()); } type_ = type; pref_value_store_ = store; diff --git a/base/prefs/testing_pref_store.cc b/base/prefs/testing_pref_store.cc index fcb48ce..b420969 100644 --- a/base/prefs/testing_pref_store.cc +++ b/base/prefs/testing_pref_store.cc @@ -30,8 +30,8 @@ void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) { observers_.RemoveObserver(observer); } -size_t TestingPrefStore::NumberOfObservers() const { - return observers_.size(); +bool TestingPrefStore::HasObservers() const { + return observers_.might_have_observers(); } bool TestingPrefStore::IsInitializationComplete() const { diff --git a/base/prefs/testing_pref_store.h b/base/prefs/testing_pref_store.h index a9f1e92..08d7125 100644 --- a/base/prefs/testing_pref_store.h +++ b/base/prefs/testing_pref_store.h @@ -25,7 +25,7 @@ class TestingPrefStore : public PersistentPrefStore { const base::Value** result) const OVERRIDE; virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; virtual bool IsInitializationComplete() const OVERRIDE; // PersistentPrefStore overrides: diff --git a/base/prefs/value_map_pref_store.cc b/base/prefs/value_map_pref_store.cc index b4b5751..750688c 100644 --- a/base/prefs/value_map_pref_store.cc +++ b/base/prefs/value_map_pref_store.cc @@ -24,8 +24,8 @@ void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { observers_.RemoveObserver(observer); } -size_t ValueMapPrefStore::NumberOfObservers() const { - return observers_.size(); +bool ValueMapPrefStore::HasObservers() const { + return observers_.might_have_observers(); } ValueMapPrefStore::~ValueMapPrefStore() {} diff --git a/base/prefs/value_map_pref_store.h b/base/prefs/value_map_pref_store.h index c9c9b1c..21e4b88 100644 --- a/base/prefs/value_map_pref_store.h +++ b/base/prefs/value_map_pref_store.h @@ -25,7 +25,7 @@ class BASE_PREFS_EXPORT ValueMapPrefStore : public PrefStore { const base::Value** value) const OVERRIDE; virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; protected: virtual ~ValueMapPrefStore(); diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 63ca6a9..3e4dd16 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -55,8 +55,8 @@ void ConfigurationPolicyPrefStore::RemoveObserver( observers_.RemoveObserver(observer); } -size_t ConfigurationPolicyPrefStore::NumberOfObservers() const { - return observers_.size(); +bool ConfigurationPolicyPrefStore::HasObservers() const { + return observers_.might_have_observers(); } bool ConfigurationPolicyPrefStore::IsInitializationComplete() const { diff --git a/chrome/browser/policy/configuration_policy_pref_store.h b/chrome/browser/policy/configuration_policy_pref_store.h index 62a6850..9aaacd4 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.h +++ b/chrome/browser/policy/configuration_policy_pref_store.h @@ -39,7 +39,7 @@ class ConfigurationPolicyPrefStore // PrefStore methods: virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; - virtual size_t NumberOfObservers() const OVERRIDE; + virtual bool HasObservers() const OVERRIDE; virtual bool IsInitializationComplete() const OVERRIDE; virtual bool GetValue(const std::string& key, const Value** result) const OVERRIDE; |