| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef BASE_OBSERVER_LIST_H_ | 5 #ifndef BASE_OBSERVER_LIST_H_ | 
| 6 #define BASE_OBSERVER_LIST_H_ | 6 #define BASE_OBSERVER_LIST_H_ | 
| 7 | 7 | 
| 8 #include <stddef.h> | 8 #include <stddef.h> | 
| 9 | 9 | 
| 10 #include <algorithm> | 10 #include <algorithm> | 
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 337       ObserverListBase<ObserverType>::Compact(); | 337       ObserverListBase<ObserverType>::Compact(); | 
| 338       DCHECK_EQ(ObserverListBase<ObserverType>::size(), 0U); | 338       DCHECK_EQ(ObserverListBase<ObserverType>::size(), 0U); | 
| 339     } | 339     } | 
| 340   } | 340   } | 
| 341 | 341 | 
| 342   bool might_have_observers() const { | 342   bool might_have_observers() const { | 
| 343     return ObserverListBase<ObserverType>::size() != 0; | 343     return ObserverListBase<ObserverType>::size() != 0; | 
| 344   } | 344   } | 
| 345 }; | 345 }; | 
| 346 | 346 | 
| 347 // Deprecated. Use the range-based for loop instead. |  | 
| 348 #define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \ |  | 
| 349   do {                                                       \ |  | 
| 350     for (ObserverType & o : observer_list)                   \ |  | 
| 351       o.func;                                                \ |  | 
| 352   } while (0) |  | 
| 353 |  | 
| 354 }  // namespace base | 347 }  // namespace base | 
| 355 | 348 | 
| 356 #endif  // BASE_OBSERVER_LIST_H_ | 349 #endif  // BASE_OBSERVER_LIST_H_ | 
| OLD | NEW | 
|---|