summaryrefslogtreecommitdiffstats
path: root/base/callback_list.h
diff options
context:
space:
mode:
authorcaitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-09 23:28:21 +0000
committercaitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-09 23:28:21 +0000
commitabdd66eb4bdd81f8a5e64cc0d4d7810b70027afa (patch)
treebb56d69c9970c4efb06303c7857e8edf3e71a7d2 /base/callback_list.h
parent58b78abb5589e81c150727c19f5639e557b86f3c (diff)
downloadchromium_src-abdd66eb4bdd81f8a5e64cc0d4d7810b70027afa.zip
chromium_src-abdd66eb4bdd81f8a5e64cc0d4d7810b70027afa.tar.gz
chromium_src-abdd66eb4bdd81f8a5e64cc0d4d7810b70027afa.tar.bz2
C++ Readability Review for caitkp
BUG=10927483 Review URL: https://codereview.chromium.org/23645019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/callback_list.h')
-rw-r--r--base/callback_list.h51
1 files changed, 25 insertions, 26 deletions
diff --git a/base/callback_list.h b/base/callback_list.h
index ead92ea..cb44c25 100644
--- a/base/callback_list.h
+++ b/base/callback_list.h
@@ -45,6 +45,8 @@
// }
//
// base::CallbackList<void(const Foo&)> callback_list_;
+//
+// DISALLOW_COPY_AND_ASSIGN(MyWidget);
// };
//
//
@@ -67,6 +69,8 @@
//
// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
// foo_subscription_;
+//
+// DISALLOW_COPY_AND_ASSIGN(MyWidgetListener);
// };
namespace base {
@@ -81,11 +85,12 @@ class CallbackListBase {
Subscription(CallbackListBase<CallbackType>* list,
typename std::list<CallbackType>::iterator iter)
: list_(list),
- iter_(iter) {}
+ iter_(iter) {
+ }
~Subscription() {
if (list_->active_iterator_count_)
- (*iter_).Reset();
+ iter_->Reset();
else
list_->callbacks_.erase(iter_);
}
@@ -145,8 +150,7 @@ class CallbackListBase {
typename std::list<CallbackType>::iterator list_iter_;
};
- CallbackListBase()
- : active_iterator_count_(0) {}
+ CallbackListBase() : active_iterator_count_(0) {}
~CallbackListBase() {
DCHECK_EQ(0, active_iterator_count_);
@@ -194,7 +198,7 @@ class CallbackList<void(void)>
internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run();
}
}
@@ -205,8 +209,7 @@ class CallbackList<void(void)>
template <typename A1>
class CallbackList<void(A1)>
- : public internal::CallbackListBase<
- Callback<void(A1)> > {
+ : public internal::CallbackListBase<Callback<void(A1)> > {
public:
typedef Callback<void(A1)> CallbackType;
@@ -216,7 +219,7 @@ class CallbackList<void(A1)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1);
}
}
@@ -227,8 +230,7 @@ class CallbackList<void(A1)>
template <typename A1, typename A2>
class CallbackList<void(A1, A2)>
- : public internal::CallbackListBase<
- Callback<void(A1, A2)> > {
+ : public internal::CallbackListBase<Callback<void(A1, A2)> > {
public:
typedef Callback<void(A1, A2)> CallbackType;
@@ -239,7 +241,7 @@ class CallbackList<void(A1, A2)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1, a2);
}
}
@@ -250,8 +252,7 @@ class CallbackList<void(A1, A2)>
template <typename A1, typename A2, typename A3>
class CallbackList<void(A1, A2, A3)>
- : public internal::CallbackListBase<
- Callback<void(A1, A2, A3)> > {
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3)> > {
public:
typedef Callback<void(A1, A2, A3)> CallbackType;
@@ -263,7 +264,7 @@ class CallbackList<void(A1, A2, A3)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1, a2, a3);
}
}
@@ -274,8 +275,7 @@ class CallbackList<void(A1, A2, A3)>
template <typename A1, typename A2, typename A3, typename A4>
class CallbackList<void(A1, A2, A3, A4)>
- : public internal::CallbackListBase<
- Callback<void(A1, A2, A3, A4)> > {
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3, A4)> > {
public:
typedef Callback<void(A1, A2, A3, A4)> CallbackType;
@@ -288,7 +288,7 @@ class CallbackList<void(A1, A2, A3, A4)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1, a2, a3, a4);
}
}
@@ -299,8 +299,7 @@ class CallbackList<void(A1, A2, A3, A4)>
template <typename A1, typename A2, typename A3, typename A4, typename A5>
class CallbackList<void(A1, A2, A3, A4, A5)>
- : public internal::CallbackListBase<
- Callback<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;
@@ -314,7 +313,7 @@ class CallbackList<void(A1, A2, A3, A4, A5)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1, a2, a3, a4, a5);
}
}
@@ -326,8 +325,8 @@ class CallbackList<void(A1, A2, A3, A4, A5)>
template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6>
class CallbackList<void(A1, A2, A3, A4, A5, A6)>
- : public internal::CallbackListBase<
- Callback<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;
@@ -342,7 +341,7 @@ class CallbackList<void(A1, A2, A3, A4, A5, A6)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1, a2, a3, a4, a5, a6);
}
}
@@ -354,8 +353,8 @@ class CallbackList<void(A1, A2, A3, A4, A5, A6)>
template <typename A1, typename A2, typename A3, typename A4, typename A5,
typename A6, typename A7>
class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
- : public internal::CallbackListBase<
- Callback<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;
@@ -371,7 +370,7 @@ class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
- while((cb = it.GetNext()) != NULL) {
+ while ((cb = it.GetNext()) != NULL) {
cb->Run(a1, a2, a3, a4, a5, a6, a7);
}
}