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

Unified Diff: base/observer_list.h

Issue 1152983004: Move ObserverList to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | 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 fb6f0262dfd512787b92b3f000dbc5afdf91dd26..2dd057c77f5b0f7d197d2250c945d6ed0a5976bf 100644
--- a/base/observer_list.h
+++ b/base/observer_list.h
@@ -51,18 +51,20 @@
// }
//
// private:
-// ObserverList<Observer> observer_list_;
+// base::ObserverList<Observer> observer_list_;
// };
//
//
///////////////////////////////////////////////////////////////////////////////
+namespace base {
+
template <typename ObserverType>
class ObserverListThreadSafe;
template <class ObserverType>
class ObserverListBase
- : public base::SupportsWeakPtr<ObserverListBase<ObserverType> > {
+ : public SupportsWeakPtr<ObserverListBase<ObserverType>> {
public:
// Enumeration of which observers are notified.
enum NotificationType {
@@ -84,7 +86,7 @@ class ObserverListBase
ObserverType* GetNext();
private:
- base::WeakPtr<ObserverListBase<ObserverType> > list_;
+ WeakPtr<ObserverListBase<ObserverType>> list_;
size_t index_;
size_t max_index_;
};
@@ -232,12 +234,17 @@ 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( \
+ base::ObserverListBase<ObserverType>::Iterator it_inside_observer_macro( \
&observer_list); \
ObserverType* obs; \
- while ((obs = it_inside_observer_macro.GetNext()) != nullptr) \
+ while ((obs = it_inside_observer_macro.GetNext()) != nullptr) \
obs->func; \
} \
} while (0)
+} // namespace base
+
+// TODO(brettw) remove this when callers use the correct namespace.
+using base::ObserverList;
+
#endif // BASE_OBSERVER_LIST_H_
« no previous file with comments | « no previous file | base/observer_list_threadsafe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698