| 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> |
| 9 |
| 8 #include <algorithm> | 10 #include <algorithm> |
| 9 #include <limits> | 11 #include <limits> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 15 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 16 | 18 |
| 17 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
| 18 // | 20 // |
| 19 // OVERVIEW: | 21 // OVERVIEW: |
| 20 // | 22 // |
| 21 // A container for a list of observers. Unlike a normal STL vector or list, | 23 // A container for a list of observers. Unlike a normal STL vector or list, |
| 22 // this container can be modified during iteration without invalidating the | 24 // this container can be modified during iteration without invalidating the |
| 23 // iterator. So, it safely handles the case of an observer removing itself | 25 // iterator. So, it safely handles the case of an observer removing itself |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 &observer_list); \ | 240 &observer_list); \ |
| 239 ObserverType* obs; \ | 241 ObserverType* obs; \ |
| 240 while ((obs = it_inside_observer_macro.GetNext()) != nullptr) \ | 242 while ((obs = it_inside_observer_macro.GetNext()) != nullptr) \ |
| 241 obs->func; \ | 243 obs->func; \ |
| 242 } \ | 244 } \ |
| 243 } while (0) | 245 } while (0) |
| 244 | 246 |
| 245 } // namespace base | 247 } // namespace base |
| 246 | 248 |
| 247 #endif // BASE_OBSERVER_LIST_H_ | 249 #endif // BASE_OBSERVER_LIST_H_ |
| OLD | NEW |