summaryrefslogtreecommitdiffstats
path: root/base/observer_list.h
diff options
context:
space:
mode:
authormgiuca <mgiuca@chromium.org>2014-11-09 22:44:23 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-10 06:44:47 +0000
commit64ccf236e6657cf0a85506c56d4ba226fdea4765 (patch)
tree32a2887d6f35225748b3ae93193fdb306575bdd0 /base/observer_list.h
parentd2b6be4e2ef7a38d503deb1f89ca96b16c85effb (diff)
downloadchromium_src-64ccf236e6657cf0a85506c56d4ba226fdea4765.zip
chromium_src-64ccf236e6657cf0a85506c56d4ba226fdea4765.tar.gz
chromium_src-64ccf236e6657cf0a85506c56d4ba226fdea4765.tar.bz2
ObserverList::HasObserver now takes a const pointer.
Updated all clients that wrap HasObserver and expose it to also take a const pointer. This change avoids further propagation of non-constness (which was previously required when using HasObserver methods). BUG=429588 TBR=michaeln@chromium.org,nyquist@chromium.org,pkotwicz@chromium.org,satorux@chromium.org,sky@chromium.org,zea@chromium.org Review URL: https://codereview.chromium.org/697953002 Cr-Commit-Position: refs/heads/master@{#303428}
Diffstat (limited to 'base/observer_list.h')
-rw-r--r--base/observer_list.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/base/observer_list.h b/base/observer_list.h
index c77ec15..ef45269 100644
--- a/base/observer_list.h
+++ b/base/observer_list.h
@@ -100,7 +100,8 @@ class ObserverListBase
// Remove an observer from the list if it is in the list.
void RemoveObserver(ObserverType* obs);
- bool HasObserver(ObserverType* observer) const;
+ // Determine whether a particular observer is in the list.
+ bool HasObserver(const ObserverType* observer) const;
void Clear();
@@ -176,7 +177,8 @@ void ObserverListBase<ObserverType>::RemoveObserver(ObserverType* obs) {
}
template <class ObserverType>
-bool ObserverListBase<ObserverType>::HasObserver(ObserverType* observer) const {
+bool ObserverListBase<ObserverType>::HasObserver(
+ const ObserverType* observer) const {
for (size_t i = 0; i < observers_.size(); ++i) {
if (observers_[i] == observer)
return true;