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

Side by Side Diff: base/observer_list.h

Issue 23672052: Fix possible naming conflict in macro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Name change Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <vector> 10 #include <vector>
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 ObserverListBase<ObserverType>::Compact(); 196 ObserverListBase<ObserverType>::Compact();
197 DCHECK_EQ(ObserverListBase<ObserverType>::size(), 0U); 197 DCHECK_EQ(ObserverListBase<ObserverType>::size(), 0U);
198 } 198 }
199 } 199 }
200 200
201 bool might_have_observers() const { 201 bool might_have_observers() const {
202 return ObserverListBase<ObserverType>::size() != 0; 202 return ObserverListBase<ObserverType>::size() != 0;
203 } 203 }
204 }; 204 };
205 205
206 #define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \ 206 #define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \
207 do { \ 207 do { \
208 if ((observer_list).might_have_observers()) { \ 208 if ((observer_list).might_have_observers()) { \
209 ObserverListBase<ObserverType>::Iterator it(observer_list); \ 209 ObserverListBase<ObserverType>::Iterator \
210 ObserverType* obs; \ 210 it_inside_observer_macro(observer_list); \
211 while ((obs = it.GetNext()) != NULL) \ 211 ObserverType* obs; \
212 obs->func; \ 212 while ((obs = it_inside_observer_macro.GetNext()) != NULL) \
213 } \ 213 obs->func; \
214 } \
214 } while (0) 215 } while (0)
215 216
216 #endif // BASE_OBSERVER_LIST_H__ 217 #endif // BASE_OBSERVER_LIST_H__
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698