summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.gyp4
-rw-r--r--base/base.gypi2
-rw-r--r--base/callback_list.h (renamed from base/callback_registry.h)134
-rw-r--r--base/callback_list.h.pump (renamed from base/callback_registry.h.pump)57
-rw-r--r--base/callback_list_unittest.cc (renamed from base/callback_registry_unittest.cc)84
-rw-r--r--base/callback_list_unittest.nc (renamed from base/callback_registry_unittest.nc)8
-rw-r--r--chrome/browser/chromeos/settings/cros_settings.cc4
-rw-r--r--chrome/browser/chromeos/settings/cros_settings.h6
-rw-r--r--chrome/browser/ui/prefs/prefs_tab_helper.h4
-rw-r--r--chrome/browser/user_style_sheet_watcher.cc8
-rw-r--r--chrome/browser/user_style_sheet_watcher.h4
11 files changed, 158 insertions, 157 deletions
diff --git a/base/base.gyp b/base/base.gyp
index 4aae198..8175d27 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -468,8 +468,8 @@
'bits_unittest.cc',
'build_time_unittest.cc',
'callback_helpers_unittest.cc',
- 'callback_registry_unittest.cc',
- 'callback_registry_unittest.nc',
+ 'callback_list_unittest.cc',
+ 'callback_list_unittest.nc',
'callback_unittest.cc',
'callback_unittest.nc',
'cancelable_callback_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index cafb10d..e30f855 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -108,7 +108,7 @@
'callback_helpers.h',
'callback_internal.cc',
'callback_internal.h',
- 'callback_registry.h',
+ 'callback_list.h',
'cancelable_callback.h',
'chromeos/chromeos_version.cc',
'chromeos/chromeos_version.h',
diff --git a/base/callback_registry.h b/base/callback_list.h
index dcdeb81..ead92ea 100644
--- a/base/callback_registry.h
+++ b/base/callback_list.h
@@ -1,5 +1,5 @@
// This file was GENERATED by command:
-// pump.py callback_registry.h.pump
+// pump.py callback_list.h.pump
// DO NOT EDIT BY HAND!!!
@@ -7,8 +7,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_CALLBACK_REGISTRY_H_
-#define BASE_CALLBACK_REGISTRY_H_
+#ifndef BASE_CALLBACK_LIST_H_
+#define BASE_CALLBACK_LIST_H_
#include <list>
@@ -34,17 +34,17 @@
//
// typedef base::Callback<void(const Foo&)> OnFooCallback;
//
-// scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription>
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
// RegisterCallback(const OnFooCallback& cb) {
-// return callback_registry_.Add(cb);
+// return callback_list_.Add(cb);
// }
//
// private:
// void NotifyFoo(const Foo& foo) {
-// callback_registry_.Notify(foo);
+// callback_list_.Notify(foo);
// }
//
-// base::CallbackRegistry<void(const Foo&)> callback_registry_;
+// base::CallbackList<void(const Foo&)> callback_list_;
// };
//
//
@@ -65,7 +65,7 @@
// // Do something.
// }
//
-// scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription>
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
// foo_subscription_;
// };
@@ -74,11 +74,11 @@ namespace base {
namespace internal {
template <typename CallbackType>
-class CallbackRegistryBase {
+class CallbackListBase {
public:
class Subscription {
public:
- Subscription(CallbackRegistryBase<CallbackType>* list,
+ Subscription(CallbackListBase<CallbackType>* list,
typename std::list<CallbackType>::iterator iter)
: list_(list),
iter_(iter) {}
@@ -91,7 +91,7 @@ class CallbackRegistryBase {
}
private:
- CallbackRegistryBase<CallbackType>* list_;
+ CallbackListBase<CallbackType>* list_;
typename std::list<CallbackType>::iterator iter_;
DISALLOW_COPY_AND_ASSIGN(Subscription);
@@ -99,7 +99,7 @@ class CallbackRegistryBase {
// Add a callback to the list. The callback will remain registered until the
// returned Subscription is destroyed, which must occur before the
- // CallbackRegistry is destroyed.
+ // CallbackList is destroyed.
scoped_ptr<Subscription> Add(const CallbackType& cb) {
DCHECK(!cb.is_null());
return scoped_ptr<Subscription>(
@@ -110,7 +110,7 @@ class CallbackRegistryBase {
// An iterator class that can be used to access the list of callbacks.
class Iterator {
public:
- explicit Iterator(CallbackRegistryBase<CallbackType>* list)
+ explicit Iterator(CallbackListBase<CallbackType>* list)
: list_(list),
list_iter_(list_->callbacks_.begin()) {
++list_->active_iterator_count_;
@@ -141,19 +141,19 @@ class CallbackRegistryBase {
}
private:
- CallbackRegistryBase<CallbackType>* list_;
+ CallbackListBase<CallbackType>* list_;
typename std::list<CallbackType>::iterator list_iter_;
};
- CallbackRegistryBase()
+ CallbackListBase()
: active_iterator_count_(0) {}
- ~CallbackRegistryBase() {
+ ~CallbackListBase() {
DCHECK_EQ(0, active_iterator_count_);
DCHECK_EQ(0U, callbacks_.size());
}
- // Returns an instance of a CallbackRegistryBase::Iterator which can be used
+ // Returns an instance of a CallbackListBase::Iterator which can be used
// to run callbacks.
Iterator GetIterator() {
return Iterator(this);
@@ -175,23 +175,23 @@ class CallbackRegistryBase {
std::list<CallbackType> callbacks_;
int active_iterator_count_;
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistryBase);
+ DISALLOW_COPY_AND_ASSIGN(CallbackListBase);
};
} // namespace internal
-template <typename Sig> class CallbackRegistry;
+template <typename Sig> class CallbackList;
template <>
-class CallbackRegistry<void(void)>
- : public internal::CallbackRegistryBase<Callback<void(void)> > {
+class CallbackList<void(void)>
+ : public internal::CallbackListBase<Callback<void(void)> > {
public:
typedef Callback<void(void)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify() {
- internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -200,20 +200,20 @@ class CallbackRegistry<void(void)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1>
-class CallbackRegistry<void(A1)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1)> > {
+class CallbackList<void(A1)>
+ : public internal::CallbackListBase<
+ Callback<void(A1)> > {
public:
typedef Callback<void(A1)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -222,21 +222,21 @@ class CallbackRegistry<void(A1)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1, typename A2>
-class CallbackRegistry<void(A1, A2)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1, A2)> > {
+class CallbackList<void(A1, A2)>
+ : public internal::CallbackListBase<
+ Callback<void(A1, A2)> > {
public:
typedef Callback<void(A1, A2)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
typename internal::CallbackParamTraits<A2>::ForwardType a2) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -245,22 +245,22 @@ class CallbackRegistry<void(A1, A2)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1, typename A2, typename A3>
-class CallbackRegistry<void(A1, A2, A3)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1, A2, A3)> > {
+class CallbackList<void(A1, A2, A3)>
+ : public internal::CallbackListBase<
+ Callback<void(A1, A2, A3)> > {
public:
typedef Callback<void(A1, A2, A3)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
typename internal::CallbackParamTraits<A2>::ForwardType a2,
typename internal::CallbackParamTraits<A3>::ForwardType a3) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -269,23 +269,23 @@ class CallbackRegistry<void(A1, A2, A3)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1, typename A2, typename A3, typename A4>
-class CallbackRegistry<void(A1, A2, A3, A4)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1, A2, A3, A4)> > {
+class CallbackList<void(A1, A2, A3, A4)>
+ : public internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4)> > {
public:
typedef Callback<void(A1, A2, A3, A4)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
typename internal::CallbackParamTraits<A2>::ForwardType a2,
typename internal::CallbackParamTraits<A3>::ForwardType a3,
typename internal::CallbackParamTraits<A4>::ForwardType a4) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -294,24 +294,24 @@ class CallbackRegistry<void(A1, A2, A3, A4)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1, typename A2, typename A3, typename A4, typename A5>
-class CallbackRegistry<void(A1, A2, A3, A4, A5)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1, A2, A3, A4, A5)> > {
+class CallbackList<void(A1, A2, A3, A4, A5)>
+ : public internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4, A5)> > {
public:
typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
typename internal::CallbackParamTraits<A2>::ForwardType a2,
typename internal::CallbackParamTraits<A3>::ForwardType a3,
typename internal::CallbackParamTraits<A4>::ForwardType a4,
typename internal::CallbackParamTraits<A5>::ForwardType a5) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -320,18 +320,18 @@ class CallbackRegistry<void(A1, A2, A3, A4, A5)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6>
-class CallbackRegistry<void(A1, A2, A3, A4, A5, A6)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1, A2, A3, A4, A5, A6)> > {
+class CallbackList<void(A1, A2, A3, A4, A5, A6)>
+ : public internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4, A5, A6)> > {
public:
typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
typename internal::CallbackParamTraits<A2>::ForwardType a2,
@@ -339,7 +339,7 @@ class CallbackRegistry<void(A1, A2, A3, A4, A5, A6)>
typename internal::CallbackParamTraits<A4>::ForwardType a4,
typename internal::CallbackParamTraits<A5>::ForwardType a5,
typename internal::CallbackParamTraits<A6>::ForwardType a6) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -348,18 +348,18 @@ class CallbackRegistry<void(A1, A2, A3, A4, A5, A6)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7>
-class CallbackRegistry<void(A1, A2, A3, A4, A5, A6, A7)>
- : public internal::CallbackRegistryBase<
- Callback<void(A1, A2, A3, A4, A5, A6, A7)> > {
+class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
+ : public internal::CallbackListBase<
+ Callback<void(A1, A2, A3, A4, A5, A6, A7)> > {
public:
typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType;
- CallbackRegistry() {}
+ CallbackList() {}
void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
typename internal::CallbackParamTraits<A2>::ForwardType a2,
@@ -368,7 +368,7 @@ class CallbackRegistry<void(A1, A2, A3, A4, A5, A6, A7)>
typename internal::CallbackParamTraits<A5>::ForwardType a5,
typename internal::CallbackParamTraits<A6>::ForwardType a6,
typename internal::CallbackParamTraits<A7>::ForwardType a7) {
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while((cb = it.GetNext()) != NULL) {
@@ -377,9 +377,9 @@ class CallbackRegistry<void(A1, A2, A3, A4, A5, A6, A7)>
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
} // namespace base
-#endif // BASE_CALLBACK_REGISTRY_H
+#endif // BASE_CALLBACK_LIST_H_
diff --git a/base/callback_registry.h.pump b/base/callback_list.h.pump
index fff1dc8..66295ec 100644
--- a/base/callback_registry.h.pump
+++ b/base/callback_list.h.pump
@@ -12,8 +12,8 @@ $var MAX_ARITY = 7
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_CALLBACK_REGISTRY_H_
-#define BASE_CALLBACK_REGISTRY_H_
+#ifndef BASE_CALLBACK_LIST_H_
+#define BASE_CALLBACK_LIST_H_
#include <list>
@@ -39,17 +39,17 @@ $var MAX_ARITY = 7
//
// typedef base::Callback<void(const Foo&)> OnFooCallback;
//
-// scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription>
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
// RegisterCallback(const OnFooCallback& cb) {
-// return callback_registry_.Add(cb);
+// return callback_list_.Add(cb);
// }
//
// private:
// void NotifyFoo(const Foo& foo) {
-// callback_registry_.Notify(foo);
+// callback_list_.Notify(foo);
// }
//
-// base::CallbackRegistry<void(const Foo&)> callback_registry_;
+// base::CallbackList<void(const Foo&)> callback_list_;
// };
//
//
@@ -70,7 +70,8 @@ $var MAX_ARITY = 7
// // Do something.
// }
//
-// scoped_ptr<base::CallbackRegistry<Foo>::Subscription> foo_subscription_;
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
+// foo_subscription_;
// };
namespace base {
@@ -78,11 +79,11 @@ namespace base {
namespace internal {
template <typename CallbackType>
-class CallbackRegistryBase {
+class CallbackListBase {
public:
class Subscription {
public:
- Subscription(CallbackRegistryBase<CallbackType>* list,
+ Subscription(CallbackListBase<CallbackType>* list,
typename std::list<CallbackType>::iterator iter)
: list_(list),
iter_(iter) {}
@@ -95,7 +96,7 @@ class CallbackRegistryBase {
}
private:
- CallbackRegistryBase<CallbackType>* list_;
+ CallbackListBase<CallbackType>* list_;
typename std::list<CallbackType>::iterator iter_;
DISALLOW_COPY_AND_ASSIGN(Subscription);
@@ -103,7 +104,7 @@ class CallbackRegistryBase {
// Add a callback to the list. The callback will remain registered until the
// returned Subscription is destroyed, which must occur before the
- // CallbackRegistry is destroyed.
+ // CallbackList is destroyed.
scoped_ptr<Subscription> Add(const CallbackType& cb) {
DCHECK(!cb.is_null());
return scoped_ptr<Subscription>(
@@ -114,7 +115,7 @@ class CallbackRegistryBase {
// An iterator class that can be used to access the list of callbacks.
class Iterator {
public:
- explicit Iterator(CallbackRegistryBase<CallbackType>* list)
+ explicit Iterator(CallbackListBase<CallbackType>* list)
: list_(list),
list_iter_(list_->callbacks_.begin()) {
++list_->active_iterator_count_;
@@ -145,19 +146,19 @@ class CallbackRegistryBase {
}
private:
- CallbackRegistryBase<CallbackType>* list_;
+ CallbackListBase<CallbackType>* list_;
typename std::list<CallbackType>::iterator list_iter_;
};
- CallbackRegistryBase()
+ CallbackListBase()
: active_iterator_count_(0) {}
- ~CallbackRegistryBase() {
+ ~CallbackListBase() {
DCHECK_EQ(0, active_iterator_count_);
DCHECK_EQ(0U, callbacks_.size());
}
- // Returns an instance of a CallbackRegistryBase::Iterator which can be used
+ // Returns an instance of a CallbackListBase::Iterator which can be used
// to run callbacks.
Iterator GetIterator() {
return Iterator(this);
@@ -179,12 +180,12 @@ class CallbackRegistryBase {
std::list<CallbackType> callbacks_;
int active_iterator_count_;
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistryBase);
+ DISALLOW_COPY_AND_ASSIGN(CallbackListBase);
};
} // namespace internal
-template <typename Sig> class CallbackRegistry;
+template <typename Sig> class CallbackList;
$range ARITY 0..MAX_ARITY
@@ -193,13 +194,13 @@ $range ARG 1..ARITY
$if ARITY == 0 [[
template <>
-class CallbackRegistry<void(void)>
- : public internal::CallbackRegistryBase<Callback<void(void)> > {
+class CallbackList<void(void)>
+ : public internal::CallbackListBase<Callback<void(void)> > {
]] $else [[
template <$for ARG , [[typename A$(ARG)]]>
-class CallbackRegistry<void($for ARG , [[A$(ARG)]])>
- : public internal::CallbackRegistryBase<
- Callback<void($for ARG , [[A$(ARG)]])> > {
+class CallbackList<void($for ARG , [[A$(ARG)]])>
+ : public internal::CallbackListBase<
+ Callback<void($for ARG , [[A$(ARG)]])> > {
]]
public:
@@ -212,17 +213,17 @@ $if ARITY == 0 [[
]]
- CallbackRegistry() {}
+ CallbackList() {}
void Notify($for ARG ,
[[typename internal::CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
$if ARITY == 0 [[
- internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
]] $else [[
- typename internal::CallbackRegistryBase<CallbackType>::Iterator it =
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
]]
@@ -233,11 +234,11 @@ $if ARITY == 0 [[
}
private:
- DISALLOW_COPY_AND_ASSIGN(CallbackRegistry);
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
]] $$ for ARITY
} // namespace base
-#endif // BASE_CALLBACK_REGISTRY_H
+#endif // BASE_CALLBACK_LIST_H_
diff --git a/base/callback_registry_unittest.cc b/base/callback_list_unittest.cc
index 826aa0d..4607129 100644
--- a/base/callback_registry_unittest.cc
+++ b/base/callback_list_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/callback_registry.h"
+#include "base/callback_list.h"
#include "base/basictypes.h"
#include "base/bind.h"
@@ -35,20 +35,20 @@ class Remover {
removal_subscription_.reset();
}
void SetSubscriptionToRemove(
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> sub) {
+ scoped_ptr<CallbackList<void(void)>::Subscription> sub) {
removal_subscription_ = sub.Pass();
}
int total_;
private:
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> removal_subscription_;
+ scoped_ptr<CallbackList<void(void)>::Subscription> removal_subscription_;
DISALLOW_COPY_AND_ASSIGN(Remover);
};
class Adder {
public:
- explicit Adder(CallbackRegistry<void(void)>* cb_reg)
+ explicit Adder(CallbackList<void(void)>* cb_reg)
: added_(false),
total_(0),
cb_reg_(cb_reg) {}
@@ -65,8 +65,8 @@ class Adder {
int total_;
private:
- CallbackRegistry<void(void)>* cb_reg_;
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> subscription_;
+ CallbackList<void(void)>* cb_reg_;
+ scoped_ptr<CallbackList<void(void)>::Subscription> subscription_;
DISALLOW_COPY_AND_ASSIGN(Adder);
};
@@ -91,47 +91,47 @@ class Summer {
DISALLOW_COPY_AND_ASSIGN(Summer);
};
-// Sanity check that we can instantiate a CallbackRegistry for each arity.
-TEST(CallbackRegistryTest, ArityTest) {
+// Sanity check that we can instantiate a CallbackList for each arity.
+TEST(CallbackListTest, ArityTest) {
Summer s;
- CallbackRegistry<void(int)> c1;
- scoped_ptr<CallbackRegistry<void(int)>::Subscription> subscription1 =
+ CallbackList<void(int)> c1;
+ scoped_ptr<CallbackList<void(int)>::Subscription> subscription1 =
c1.Add(Bind(&Summer::AddOneParam, Unretained(&s)));
c1.Notify(1);
EXPECT_EQ(1, s.value_);
- CallbackRegistry<void(int, int)> c2;
- scoped_ptr<CallbackRegistry<void(int, int)>::Subscription> subscription2 =
+ CallbackList<void(int, int)> c2;
+ scoped_ptr<CallbackList<void(int, int)>::Subscription> subscription2 =
c2.Add(Bind(&Summer::AddTwoParam, Unretained(&s)));
c2.Notify(1, 2);
EXPECT_EQ(3, s.value_);
- CallbackRegistry<void(int, int, int)> c3;
- scoped_ptr<CallbackRegistry<void(int, int, int)>::Subscription>
+ CallbackList<void(int, int, int)> c3;
+ scoped_ptr<CallbackList<void(int, int, int)>::Subscription>
subscription3 = c3.Add(Bind(&Summer::AddThreeParam, Unretained(&s)));
c3.Notify(1, 2, 3);
EXPECT_EQ(6, s.value_);
- CallbackRegistry<void(int, int, int, int)> c4;
- scoped_ptr<CallbackRegistry<void(int, int, int, int)>::Subscription>
+ CallbackList<void(int, int, int, int)> c4;
+ scoped_ptr<CallbackList<void(int, int, int, int)>::Subscription>
subscription4 = c4.Add(Bind(&Summer::AddFourParam, Unretained(&s)));
c4.Notify(1, 2, 3, 4);
EXPECT_EQ(10, s.value_);
- CallbackRegistry<void(int, int, int, int, int)> c5;
- scoped_ptr<CallbackRegistry<void(int, int, int, int, int)>::Subscription>
+ CallbackList<void(int, int, int, int, int)> c5;
+ scoped_ptr<CallbackList<void(int, int, int, int, int)>::Subscription>
subscription5 = c5.Add(Bind(&Summer::AddFiveParam, Unretained(&s)));
c5.Notify(1, 2, 3, 4, 5);
EXPECT_EQ(15, s.value_);
- CallbackRegistry<void(int, int, int, int, int, int)> c6;
- scoped_ptr<CallbackRegistry<void(int, int, int, int, int, int)>::Subscription>
+ CallbackList<void(int, int, int, int, int, int)> c6;
+ scoped_ptr<CallbackList<void(int, int, int, int, int, int)>::Subscription>
subscription6 = c6.Add(Bind(&Summer::AddSixParam, Unretained(&s)));
c6.Notify(1, 2, 3, 4, 5, 6);
@@ -140,13 +140,13 @@ TEST(CallbackRegistryTest, ArityTest) {
// Sanity check that closures added to the list will be run, and those removed
// from the list will not be run.
-TEST(CallbackRegistryTest, BasicTest) {
- CallbackRegistry<void(void)> cb_reg;
+TEST(CallbackListTest, BasicTest) {
+ CallbackList<void(void)> cb_reg;
Listener a, b, c;
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> a_subscription =
cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&a)));
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> b_subscription =
cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b)));
EXPECT_TRUE(a_subscription.get());
@@ -159,7 +159,7 @@ TEST(CallbackRegistryTest, BasicTest) {
b_subscription.reset();
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> c_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> c_subscription =
cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&c)));
cb_reg.Notify();
@@ -175,13 +175,13 @@ TEST(CallbackRegistryTest, BasicTest) {
// Sanity check that callbacks with details added to the list will be run, with
// the correct details, and those removed from the list will not be run.
-TEST(CallbackRegistryTest, BasicTestWithParams) {
- CallbackRegistry<void(int)> cb_reg;
+TEST(CallbackListTest, BasicTestWithParams) {
+ CallbackList<void(int)> cb_reg;
Listener a(1), b(-1), c(1);
- scoped_ptr<CallbackRegistry<void(int)>::Subscription> a_subscription =
+ scoped_ptr<CallbackList<void(int)>::Subscription> a_subscription =
cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&a)));
- scoped_ptr<CallbackRegistry<void(int)>::Subscription> b_subscription =
+ scoped_ptr<CallbackList<void(int)>::Subscription> b_subscription =
cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&b)));
EXPECT_TRUE(a_subscription.get());
@@ -194,7 +194,7 @@ TEST(CallbackRegistryTest, BasicTestWithParams) {
b_subscription.reset();
- scoped_ptr<CallbackRegistry<void(int)>::Subscription> c_subscription =
+ scoped_ptr<CallbackList<void(int)>::Subscription> c_subscription =
cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&c)));
cb_reg.Notify(10);
@@ -210,20 +210,20 @@ TEST(CallbackRegistryTest, BasicTestWithParams) {
// Test the a callback can remove itself or a different callback from the list
// during iteration without invalidating the iterator.
-TEST(CallbackRegistryTest, RemoveCallbacksDuringIteration) {
- CallbackRegistry<void(void)> cb_reg;
+TEST(CallbackListTest, RemoveCallbacksDuringIteration) {
+ CallbackList<void(void)> cb_reg;
Listener a, b;
Remover remover_1, remover_2;
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> remover_1_sub =
+ scoped_ptr<CallbackList<void(void)>::Subscription> remover_1_sub =
cb_reg.Add(Bind(&Remover::IncrementTotalAndRemove,
Unretained(&remover_1)));
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> remover_2_sub =
+ scoped_ptr<CallbackList<void(void)>::Subscription> remover_2_sub =
cb_reg.Add(Bind(&Remover::IncrementTotalAndRemove,
Unretained(&remover_2)));
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> a_subscription =
cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&a)));
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> b_subscription =
cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b)));
// |remover_1| will remove itself.
@@ -252,13 +252,13 @@ TEST(CallbackRegistryTest, RemoveCallbacksDuringIteration) {
// Test that a callback can add another callback to the list durning iteration
// without invalidating the iterator. The newly added callback should be run on
// the current iteration as will all other callbacks in the list.
-TEST(CallbackRegistryTest, AddCallbacksDuringIteration) {
- CallbackRegistry<void(void)> cb_reg;
+TEST(CallbackListTest, AddCallbacksDuringIteration) {
+ CallbackList<void(void)> cb_reg;
Adder a(&cb_reg);
Listener b;
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> a_subscription =
cb_reg.Add(Bind(&Adder::AddCallback, Unretained(&a)));
- scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription =
+ scoped_ptr<CallbackList<void(void)>::Subscription> b_subscription =
cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b)));
cb_reg.Notify();
@@ -274,8 +274,8 @@ TEST(CallbackRegistryTest, AddCallbacksDuringIteration) {
}
// Sanity check: notifying an empty list is a no-op.
-TEST(CallbackRegistryTest, EmptyList) {
- CallbackRegistry<void(void)> cb_reg;
+TEST(CallbackListTest, EmptyList) {
+ CallbackList<void(void)> cb_reg;
cb_reg.Notify();
}
diff --git a/base/callback_registry_unittest.nc b/base/callback_list_unittest.nc
index d67ad81..2d464cf 100644
--- a/base/callback_registry_unittest.nc
+++ b/base/callback_list_unittest.nc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/callback_registry.h"
+#include "base/callback_list.h"
#include "base/basictypes.h"
#include "base/bind.h"
@@ -34,14 +34,14 @@ class FooListener {
// Callbacks run with a move-only typed parameter.
//
-// CallbackRegistry does not support move-only typed parameters. Notify() is
+// CallbackList does not support move-only typed parameters. Notify() is
// designed to take zero or more parameters, and run each registered callback
// with them. With move-only types, the parameter will be set to NULL after the
// first callback has been run.
void WontCompile() {
FooListener f;
- CallbackRegistry<void(scoped_ptr<Foo>)> c1;
- scoped_ptr<CallbackRegistry<void(scoped_ptr<Foo>)>::Subscription> sub =
+ CallbackList<void(scoped_ptr<Foo>)> c1;
+ scoped_ptr<CallbackList<void(scoped_ptr<Foo>)>::Subscription> sub =
c1.Add(Bind(&FooListener::GotAScopedFoo, Unretained(&f)));
c1.Notify(scoped_ptr<Foo>(new Foo()));
}
diff --git a/chrome/browser/chromeos/settings/cros_settings.cc b/chrome/browser/chromeos/settings/cros_settings.cc
index 9023c0a..382add7 100644
--- a/chrome/browser/chromeos/settings/cros_settings.cc
+++ b/chrome/browser/chromeos/settings/cros_settings.cc
@@ -272,11 +272,11 @@ CrosSettings::AddSettingsObserver(const std::string& path,
}
// Get the callback registry associated with the path.
- base::CallbackRegistry<void(void)>* registry = NULL;
+ base::CallbackList<void(void)>* registry = NULL;
SettingsObserverMap::iterator observer_iterator =
settings_observers_.find(path);
if (observer_iterator == settings_observers_.end()) {
- registry = new base::CallbackRegistry<void(void)>;
+ registry = new base::CallbackList<void(void)>;
settings_observers_[path] = registry;
} else {
registry = observer_iterator->second;
diff --git a/chrome/browser/chromeos/settings/cros_settings.h b/chrome/browser/chromeos/settings/cros_settings.h
index 77f8194..c96c091 100644
--- a/chrome/browser/chromeos/settings/cros_settings.h
+++ b/chrome/browser/chromeos/settings/cros_settings.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/callback_registry.h"
+#include "base/callback_list.h"
#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
@@ -94,7 +94,7 @@ class CrosSettings : public base::NonThreadSafe {
bool RemoveSettingsProvider(CrosSettingsProvider* provider);
// Add an observer Callback for changes for the given |path|.
- typedef base::CallbackRegistry<void(void)>::Subscription ObserverSubscription;
+ typedef base::CallbackList<void(void)>::Subscription ObserverSubscription;
scoped_ptr<ObserverSubscription> AddSettingsObserver(
const std::string& path,
const base::Closure& callback);
@@ -113,7 +113,7 @@ class CrosSettings : public base::NonThreadSafe {
// A map from settings names to a list of observers. Observers get fired in
// the order they are added.
- typedef base::hash_map<std::string, base::CallbackRegistry<void(void)>*>
+ typedef base::hash_map<std::string, base::CallbackList<void(void)>*>
SettingsObserverMap;
SettingsObserverMap settings_observers_;
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h
index 431c48e..9e9ea9c 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.h
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_
#define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_
-#include "base/callback_registry.h"
+#include "base/callback_list.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "base/prefs/pref_change_registrar.h"
@@ -58,7 +58,7 @@ class PrefsTabHelper : public content::NotificationObserver,
content::NotificationRegistrar registrar_;
PrefChangeRegistrar pref_change_registrar_;
base::WeakPtrFactory<PrefsTabHelper> weak_ptr_factory_;
- scoped_ptr<base::CallbackRegistry<void(void)>::Subscription>
+ scoped_ptr<base::CallbackList<void(void)>::Subscription>
style_sheet_subscription_;
DISALLOW_COPY_AND_ASSIGN(PrefsTabHelper);
diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc
index f52a705..0757412 100644
--- a/chrome/browser/user_style_sheet_watcher.cc
+++ b/chrome/browser/user_style_sheet_watcher.cc
@@ -57,7 +57,7 @@ class UserStyleSheetLoader
void LoadStyleSheet(const base::FilePath& style_sheet_file);
// Register a callback to be called whenever the stylesheet gets updated.
- scoped_ptr<base::CallbackRegistry<void(void)>::Subscription>
+ scoped_ptr<base::CallbackList<void(void)>::Subscription>
RegisterOnStyleSheetUpdatedCallback(const base::Closure& callback);
// Send out a notification if the stylesheet has already been loaded.
@@ -79,7 +79,7 @@ class UserStyleSheetLoader
// Whether the stylesheet has been loaded.
bool has_loaded_;
- base::CallbackRegistry<void(void)> style_sheet_updated_callbacks_;
+ base::CallbackList<void(void)> style_sheet_updated_callbacks_;
DISALLOW_COPY_AND_ASSIGN(UserStyleSheetLoader);
};
@@ -91,7 +91,7 @@ UserStyleSheetLoader::UserStyleSheetLoader()
UserStyleSheetLoader::~UserStyleSheetLoader() {
}
-scoped_ptr<base::CallbackRegistry<void(void)>::Subscription>
+scoped_ptr<base::CallbackList<void(void)>::Subscription>
UserStyleSheetLoader::RegisterOnStyleSheetUpdatedCallback(
const base::Closure& callback) {
return style_sheet_updated_callbacks_.Add(callback);
@@ -192,7 +192,7 @@ GURL UserStyleSheetWatcher::user_style_sheet() const {
return loader_->user_style_sheet();
}
-scoped_ptr<base::CallbackRegistry<void(void)>::Subscription>
+scoped_ptr<base::CallbackList<void(void)>::Subscription>
UserStyleSheetWatcher::RegisterOnStyleSheetUpdatedCallback(
const base::Closure& callback) {
return loader_->RegisterOnStyleSheetUpdatedCallback(callback);
diff --git a/chrome/browser/user_style_sheet_watcher.h b/chrome/browser/user_style_sheet_watcher.h
index b2d4dfb..a8bf140 100644
--- a/chrome/browser/user_style_sheet_watcher.h
+++ b/chrome/browser/user_style_sheet_watcher.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_
#define CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_
-#include "base/callback_registry.h"
+#include "base/callback_list.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/memory/ref_counted.h"
@@ -32,7 +32,7 @@ class UserStyleSheetWatcher
GURL user_style_sheet() const;
// Register a callback to be called whenever the stylesheet gets updated.
- scoped_ptr<base::CallbackRegistry<void(void)>::Subscription>
+ scoped_ptr<base::CallbackList<void(void)>::Subscription>
RegisterOnStyleSheetUpdatedCallback(const base::Closure& callback);
// content::NotificationObserver interface