Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: base/observer_list.h

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/numerics/safe_math_impl.h ('k') | base/observer_list_threadsafe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/observer_list.h
diff --git a/base/observer_list.h b/base/observer_list.h
index ef45269ed6e60ea3b4a63342ca474318c6521906..f7b92679e9e37af4d3c6d6492da93aed9789cd4e 100644
--- a/base/observer_list.h
+++ b/base/observer_list.h
@@ -79,7 +79,7 @@ class ObserverListBase
// also the FOR_EACH_OBSERVER macro defined below.
class Iterator {
public:
- Iterator(ObserverListBase<ObserverType>& list);
+ explicit Iterator(ObserverListBase<ObserverType>* list);
~Iterator();
ObserverType* GetNext();
@@ -126,12 +126,11 @@ class ObserverListBase
template <class ObserverType>
ObserverListBase<ObserverType>::Iterator::Iterator(
- ObserverListBase<ObserverType>& list)
- : list_(list.AsWeakPtr()),
+ ObserverListBase<ObserverType>* list)
+ : list_(list->AsWeakPtr()),
index_(0),
- max_index_(list.type_ == NOTIFY_ALL ?
- std::numeric_limits<size_t>::max() :
- list.observers_.size()) {
+ max_index_(list->type_ == NOTIFY_ALL ? std::numeric_limits<size_t>::max()
+ : list->observers_.size()) {
++list_->notify_depth_;
}
@@ -228,15 +227,15 @@ class ObserverList : public ObserverListBase<ObserverType> {
}
};
-#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \
- do { \
- if ((observer_list).might_have_observers()) { \
- ObserverListBase<ObserverType>::Iterator \
- it_inside_observer_macro(observer_list); \
- ObserverType* obs; \
- while ((obs = it_inside_observer_macro.GetNext()) != NULL) \
- obs->func; \
- } \
+#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \
+ do { \
+ if ((observer_list).might_have_observers()) { \
+ ObserverListBase<ObserverType>::Iterator it_inside_observer_macro( \
+ &observer_list); \
+ ObserverType* obs; \
+ while ((obs = it_inside_observer_macro.GetNext()) != NULL) \
+ obs->func; \
+ } \
} while (0)
#endif // BASE_OBSERVER_LIST_H__
« no previous file with comments | « base/numerics/safe_math_impl.h ('k') | base/observer_list_threadsafe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698