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

Side by Side Diff: base/callback_list.h

Issue 24648002: Rename CallbackRegistry to CallbackList (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Doc fix Created 7 years, 2 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 | « base/base.gypi ('k') | base/callback_list.h.pump » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py callback_registry.h.pump 2 // pump.py callback_list.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 5
6 // Copyright 2013 The Chromium Authors. All rights reserved. 6 // Copyright 2013 The Chromium Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be 7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. 8 // found in the LICENSE file.
9 9
10 #ifndef BASE_CALLBACK_REGISTRY_H_ 10 #ifndef BASE_CALLBACK_LIST_H_
11 #define BASE_CALLBACK_REGISTRY_H_ 11 #define BASE_CALLBACK_LIST_H_
12 12
13 #include <list> 13 #include <list>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/callback_internal.h" 17 #include "base/callback_internal.h"
18 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 21
22 // OVERVIEW: 22 // OVERVIEW:
23 // 23 //
24 // A container for a list of callbacks. Unlike a normal STL vector or list, 24 // A container for a list of callbacks. Unlike a normal STL vector or list,
25 // this container can be modified during iteration without invalidating the 25 // this container can be modified during iteration without invalidating the
26 // iterator. It safely handles the case of a callback removing itself 26 // iterator. It safely handles the case of a callback removing itself
27 // or another callback from the list while callbacks are being run. 27 // or another callback from the list while callbacks are being run.
28 // 28 //
29 // TYPICAL USAGE: 29 // TYPICAL USAGE:
30 // 30 //
31 // class MyWidget { 31 // class MyWidget {
32 // public: 32 // public:
33 // ... 33 // ...
34 // 34 //
35 // typedef base::Callback<void(const Foo&)> OnFooCallback; 35 // typedef base::Callback<void(const Foo&)> OnFooCallback;
36 // 36 //
37 // scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription> 37 // scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
38 // RegisterCallback(const OnFooCallback& cb) { 38 // RegisterCallback(const OnFooCallback& cb) {
39 // return callback_registry_.Add(cb); 39 // return callback_list_.Add(cb);
40 // } 40 // }
41 // 41 //
42 // private: 42 // private:
43 // void NotifyFoo(const Foo& foo) { 43 // void NotifyFoo(const Foo& foo) {
44 // callback_registry_.Notify(foo); 44 // callback_list_.Notify(foo);
45 // } 45 // }
46 // 46 //
47 // base::CallbackRegistry<void(const Foo&)> callback_registry_; 47 // base::CallbackList<void(const Foo&)> callback_list_;
48 // }; 48 // };
49 // 49 //
50 // 50 //
51 // class MyWidgetListener { 51 // class MyWidgetListener {
52 // public: 52 // public:
53 // MyWidgetListener::MyWidgetListener() { 53 // MyWidgetListener::MyWidgetListener() {
54 // foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback( 54 // foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback(
55 // base::Bind(&MyWidgetListener::OnFoo, this))); 55 // base::Bind(&MyWidgetListener::OnFoo, this)));
56 // } 56 // }
57 // 57 //
58 // MyWidgetListener::~MyWidgetListener() { 58 // MyWidgetListener::~MyWidgetListener() {
59 // // Subscription gets deleted automatically and will deregister 59 // // Subscription gets deleted automatically and will deregister
60 // // the callback in the process. 60 // // the callback in the process.
61 // } 61 // }
62 // 62 //
63 // private: 63 // private:
64 // void OnFoo(const Foo& foo) { 64 // void OnFoo(const Foo& foo) {
65 // // Do something. 65 // // Do something.
66 // } 66 // }
67 // 67 //
68 // scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription> 68 // scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
69 // foo_subscription_; 69 // foo_subscription_;
70 // }; 70 // };
71 71
72 namespace base { 72 namespace base {
73 73
74 namespace internal { 74 namespace internal {
75 75
76 template <typename CallbackType> 76 template <typename CallbackType>
77 class CallbackRegistryBase { 77 class CallbackListBase {
78 public: 78 public:
79 class Subscription { 79 class Subscription {
80 public: 80 public:
81 Subscription(CallbackRegistryBase<CallbackType>* list, 81 Subscription(CallbackListBase<CallbackType>* list,
82 typename std::list<CallbackType>::iterator iter) 82 typename std::list<CallbackType>::iterator iter)
83 : list_(list), 83 : list_(list),
84 iter_(iter) {} 84 iter_(iter) {}
85 85
86 ~Subscription() { 86 ~Subscription() {
87 if (list_->active_iterator_count_) 87 if (list_->active_iterator_count_)
88 (*iter_).Reset(); 88 (*iter_).Reset();
89 else 89 else
90 list_->callbacks_.erase(iter_); 90 list_->callbacks_.erase(iter_);
91 } 91 }
92 92
93 private: 93 private:
94 CallbackRegistryBase<CallbackType>* list_; 94 CallbackListBase<CallbackType>* list_;
95 typename std::list<CallbackType>::iterator iter_; 95 typename std::list<CallbackType>::iterator iter_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(Subscription); 97 DISALLOW_COPY_AND_ASSIGN(Subscription);
98 }; 98 };
99 99
100 // Add a callback to the list. The callback will remain registered until the 100 // Add a callback to the list. The callback will remain registered until the
101 // returned Subscription is destroyed, which must occur before the 101 // returned Subscription is destroyed, which must occur before the
102 // CallbackRegistry is destroyed. 102 // CallbackList is destroyed.
103 scoped_ptr<Subscription> Add(const CallbackType& cb) { 103 scoped_ptr<Subscription> Add(const CallbackType& cb) {
104 DCHECK(!cb.is_null()); 104 DCHECK(!cb.is_null());
105 return scoped_ptr<Subscription>( 105 return scoped_ptr<Subscription>(
106 new Subscription(this, callbacks_.insert(callbacks_.end(), cb))); 106 new Subscription(this, callbacks_.insert(callbacks_.end(), cb)));
107 } 107 }
108 108
109 protected: 109 protected:
110 // An iterator class that can be used to access the list of callbacks. 110 // An iterator class that can be used to access the list of callbacks.
111 class Iterator { 111 class Iterator {
112 public: 112 public:
113 explicit Iterator(CallbackRegistryBase<CallbackType>* list) 113 explicit Iterator(CallbackListBase<CallbackType>* list)
114 : list_(list), 114 : list_(list),
115 list_iter_(list_->callbacks_.begin()) { 115 list_iter_(list_->callbacks_.begin()) {
116 ++list_->active_iterator_count_; 116 ++list_->active_iterator_count_;
117 } 117 }
118 118
119 Iterator(const Iterator& iter) 119 Iterator(const Iterator& iter)
120 : list_(iter.list_), 120 : list_(iter.list_),
121 list_iter_(iter.list_iter_) { 121 list_iter_(iter.list_iter_) {
122 ++list_->active_iterator_count_; 122 ++list_->active_iterator_count_;
123 } 123 }
(...skipping 10 matching lines...) Expand all
134 134
135 CallbackType* cb = NULL; 135 CallbackType* cb = NULL;
136 if (list_iter_ != list_->callbacks_.end()) { 136 if (list_iter_ != list_->callbacks_.end()) {
137 cb = &(*list_iter_); 137 cb = &(*list_iter_);
138 ++list_iter_; 138 ++list_iter_;
139 } 139 }
140 return cb; 140 return cb;
141 } 141 }
142 142
143 private: 143 private:
144 CallbackRegistryBase<CallbackType>* list_; 144 CallbackListBase<CallbackType>* list_;
145 typename std::list<CallbackType>::iterator list_iter_; 145 typename std::list<CallbackType>::iterator list_iter_;
146 }; 146 };
147 147
148 CallbackRegistryBase() 148 CallbackListBase()
149 : active_iterator_count_(0) {} 149 : active_iterator_count_(0) {}
150 150
151 ~CallbackRegistryBase() { 151 ~CallbackListBase() {
152 DCHECK_EQ(0, active_iterator_count_); 152 DCHECK_EQ(0, active_iterator_count_);
153 DCHECK_EQ(0U, callbacks_.size()); 153 DCHECK_EQ(0U, callbacks_.size());
154 } 154 }
155 155
156 // Returns an instance of a CallbackRegistryBase::Iterator which can be used 156 // Returns an instance of a CallbackListBase::Iterator which can be used
157 // to run callbacks. 157 // to run callbacks.
158 Iterator GetIterator() { 158 Iterator GetIterator() {
159 return Iterator(this); 159 return Iterator(this);
160 } 160 }
161 161
162 // Compact the list: remove any entries which were NULLed out during 162 // Compact the list: remove any entries which were NULLed out during
163 // iteration. 163 // iteration.
164 void Compact() { 164 void Compact() {
165 typename std::list<CallbackType>::iterator it = callbacks_.begin(); 165 typename std::list<CallbackType>::iterator it = callbacks_.begin();
166 while (it != callbacks_.end()) { 166 while (it != callbacks_.end()) {
167 if ((*it).is_null()) 167 if ((*it).is_null())
168 it = callbacks_.erase(it); 168 it = callbacks_.erase(it);
169 else 169 else
170 ++it; 170 ++it;
171 } 171 }
172 } 172 }
173 173
174 private: 174 private:
175 std::list<CallbackType> callbacks_; 175 std::list<CallbackType> callbacks_;
176 int active_iterator_count_; 176 int active_iterator_count_;
177 177
178 DISALLOW_COPY_AND_ASSIGN(CallbackRegistryBase); 178 DISALLOW_COPY_AND_ASSIGN(CallbackListBase);
179 }; 179 };
180 180
181 } // namespace internal 181 } // namespace internal
182 182
183 template <typename Sig> class CallbackRegistry; 183 template <typename Sig> class CallbackList;
184 184
185 template <> 185 template <>
186 class CallbackRegistry<void(void)> 186 class CallbackList<void(void)>
187 : public internal::CallbackRegistryBase<Callback<void(void)> > { 187 : public internal::CallbackListBase<Callback<void(void)> > {
188 public: 188 public:
189 typedef Callback<void(void)> CallbackType; 189 typedef Callback<void(void)> CallbackType;
190 190
191 CallbackRegistry() {} 191 CallbackList() {}
192 192
193 void Notify() { 193 void Notify() {
194 internal::CallbackRegistryBase<CallbackType>::Iterator it = 194 internal::CallbackListBase<CallbackType>::Iterator it =
195 this->GetIterator(); 195 this->GetIterator();
196 CallbackType* cb; 196 CallbackType* cb;
197 while((cb = it.GetNext()) != NULL) { 197 while((cb = it.GetNext()) != NULL) {
198 cb->Run(); 198 cb->Run();
199 } 199 }
200 } 200 }
201 201
202 private: 202 private:
203 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 203 DISALLOW_COPY_AND_ASSIGN(CallbackList);
204 }; 204 };
205 205
206 template <typename A1> 206 template <typename A1>
207 class CallbackRegistry<void(A1)> 207 class CallbackList<void(A1)>
208 : public internal::CallbackRegistryBase< 208 : public internal::CallbackListBase<
209 Callback<void(A1)> > { 209 Callback<void(A1)> > {
210 public: 210 public:
211 typedef Callback<void(A1)> CallbackType; 211 typedef Callback<void(A1)> CallbackType;
212 212
213 CallbackRegistry() {} 213 CallbackList() {}
214 214
215 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1) { 215 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1) {
216 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 216 typename internal::CallbackListBase<CallbackType>::Iterator it =
217 this->GetIterator(); 217 this->GetIterator();
218 CallbackType* cb; 218 CallbackType* cb;
219 while((cb = it.GetNext()) != NULL) { 219 while((cb = it.GetNext()) != NULL) {
220 cb->Run(a1); 220 cb->Run(a1);
221 } 221 }
222 } 222 }
223 223
224 private: 224 private:
225 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 225 DISALLOW_COPY_AND_ASSIGN(CallbackList);
226 }; 226 };
227 227
228 template <typename A1, typename A2> 228 template <typename A1, typename A2>
229 class CallbackRegistry<void(A1, A2)> 229 class CallbackList<void(A1, A2)>
230 : public internal::CallbackRegistryBase< 230 : public internal::CallbackListBase<
231 Callback<void(A1, A2)> > { 231 Callback<void(A1, A2)> > {
232 public: 232 public:
233 typedef Callback<void(A1, A2)> CallbackType; 233 typedef Callback<void(A1, A2)> CallbackType;
234 234
235 CallbackRegistry() {} 235 CallbackList() {}
236 236
237 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, 237 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
238 typename internal::CallbackParamTraits<A2>::ForwardType a2) { 238 typename internal::CallbackParamTraits<A2>::ForwardType a2) {
239 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 239 typename internal::CallbackListBase<CallbackType>::Iterator it =
240 this->GetIterator(); 240 this->GetIterator();
241 CallbackType* cb; 241 CallbackType* cb;
242 while((cb = it.GetNext()) != NULL) { 242 while((cb = it.GetNext()) != NULL) {
243 cb->Run(a1, a2); 243 cb->Run(a1, a2);
244 } 244 }
245 } 245 }
246 246
247 private: 247 private:
248 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 248 DISALLOW_COPY_AND_ASSIGN(CallbackList);
249 }; 249 };
250 250
251 template <typename A1, typename A2, typename A3> 251 template <typename A1, typename A2, typename A3>
252 class CallbackRegistry<void(A1, A2, A3)> 252 class CallbackList<void(A1, A2, A3)>
253 : public internal::CallbackRegistryBase< 253 : public internal::CallbackListBase<
254 Callback<void(A1, A2, A3)> > { 254 Callback<void(A1, A2, A3)> > {
255 public: 255 public:
256 typedef Callback<void(A1, A2, A3)> CallbackType; 256 typedef Callback<void(A1, A2, A3)> CallbackType;
257 257
258 CallbackRegistry() {} 258 CallbackList() {}
259 259
260 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, 260 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
261 typename internal::CallbackParamTraits<A2>::ForwardType a2, 261 typename internal::CallbackParamTraits<A2>::ForwardType a2,
262 typename internal::CallbackParamTraits<A3>::ForwardType a3) { 262 typename internal::CallbackParamTraits<A3>::ForwardType a3) {
263 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 263 typename internal::CallbackListBase<CallbackType>::Iterator it =
264 this->GetIterator(); 264 this->GetIterator();
265 CallbackType* cb; 265 CallbackType* cb;
266 while((cb = it.GetNext()) != NULL) { 266 while((cb = it.GetNext()) != NULL) {
267 cb->Run(a1, a2, a3); 267 cb->Run(a1, a2, a3);
268 } 268 }
269 } 269 }
270 270
271 private: 271 private:
272 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 272 DISALLOW_COPY_AND_ASSIGN(CallbackList);
273 }; 273 };
274 274
275 template <typename A1, typename A2, typename A3, typename A4> 275 template <typename A1, typename A2, typename A3, typename A4>
276 class CallbackRegistry<void(A1, A2, A3, A4)> 276 class CallbackList<void(A1, A2, A3, A4)>
277 : public internal::CallbackRegistryBase< 277 : public internal::CallbackListBase<
278 Callback<void(A1, A2, A3, A4)> > { 278 Callback<void(A1, A2, A3, A4)> > {
279 public: 279 public:
280 typedef Callback<void(A1, A2, A3, A4)> CallbackType; 280 typedef Callback<void(A1, A2, A3, A4)> CallbackType;
281 281
282 CallbackRegistry() {} 282 CallbackList() {}
283 283
284 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, 284 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
285 typename internal::CallbackParamTraits<A2>::ForwardType a2, 285 typename internal::CallbackParamTraits<A2>::ForwardType a2,
286 typename internal::CallbackParamTraits<A3>::ForwardType a3, 286 typename internal::CallbackParamTraits<A3>::ForwardType a3,
287 typename internal::CallbackParamTraits<A4>::ForwardType a4) { 287 typename internal::CallbackParamTraits<A4>::ForwardType a4) {
288 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 288 typename internal::CallbackListBase<CallbackType>::Iterator it =
289 this->GetIterator(); 289 this->GetIterator();
290 CallbackType* cb; 290 CallbackType* cb;
291 while((cb = it.GetNext()) != NULL) { 291 while((cb = it.GetNext()) != NULL) {
292 cb->Run(a1, a2, a3, a4); 292 cb->Run(a1, a2, a3, a4);
293 } 293 }
294 } 294 }
295 295
296 private: 296 private:
297 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 297 DISALLOW_COPY_AND_ASSIGN(CallbackList);
298 }; 298 };
299 299
300 template <typename A1, typename A2, typename A3, typename A4, typename A5> 300 template <typename A1, typename A2, typename A3, typename A4, typename A5>
301 class CallbackRegistry<void(A1, A2, A3, A4, A5)> 301 class CallbackList<void(A1, A2, A3, A4, A5)>
302 : public internal::CallbackRegistryBase< 302 : public internal::CallbackListBase<
303 Callback<void(A1, A2, A3, A4, A5)> > { 303 Callback<void(A1, A2, A3, A4, A5)> > {
304 public: 304 public:
305 typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType; 305 typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType;
306 306
307 CallbackRegistry() {} 307 CallbackList() {}
308 308
309 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, 309 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
310 typename internal::CallbackParamTraits<A2>::ForwardType a2, 310 typename internal::CallbackParamTraits<A2>::ForwardType a2,
311 typename internal::CallbackParamTraits<A3>::ForwardType a3, 311 typename internal::CallbackParamTraits<A3>::ForwardType a3,
312 typename internal::CallbackParamTraits<A4>::ForwardType a4, 312 typename internal::CallbackParamTraits<A4>::ForwardType a4,
313 typename internal::CallbackParamTraits<A5>::ForwardType a5) { 313 typename internal::CallbackParamTraits<A5>::ForwardType a5) {
314 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 314 typename internal::CallbackListBase<CallbackType>::Iterator it =
315 this->GetIterator(); 315 this->GetIterator();
316 CallbackType* cb; 316 CallbackType* cb;
317 while((cb = it.GetNext()) != NULL) { 317 while((cb = it.GetNext()) != NULL) {
318 cb->Run(a1, a2, a3, a4, a5); 318 cb->Run(a1, a2, a3, a4, a5);
319 } 319 }
320 } 320 }
321 321
322 private: 322 private:
323 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 323 DISALLOW_COPY_AND_ASSIGN(CallbackList);
324 }; 324 };
325 325
326 template <typename A1, typename A2, typename A3, typename A4, typename A5, 326 template <typename A1, typename A2, typename A3, typename A4, typename A5,
327 typename A6> 327 typename A6>
328 class CallbackRegistry<void(A1, A2, A3, A4, A5, A6)> 328 class CallbackList<void(A1, A2, A3, A4, A5, A6)>
329 : public internal::CallbackRegistryBase< 329 : public internal::CallbackListBase<
330 Callback<void(A1, A2, A3, A4, A5, A6)> > { 330 Callback<void(A1, A2, A3, A4, A5, A6)> > {
331 public: 331 public:
332 typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType; 332 typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType;
333 333
334 CallbackRegistry() {} 334 CallbackList() {}
335 335
336 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, 336 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
337 typename internal::CallbackParamTraits<A2>::ForwardType a2, 337 typename internal::CallbackParamTraits<A2>::ForwardType a2,
338 typename internal::CallbackParamTraits<A3>::ForwardType a3, 338 typename internal::CallbackParamTraits<A3>::ForwardType a3,
339 typename internal::CallbackParamTraits<A4>::ForwardType a4, 339 typename internal::CallbackParamTraits<A4>::ForwardType a4,
340 typename internal::CallbackParamTraits<A5>::ForwardType a5, 340 typename internal::CallbackParamTraits<A5>::ForwardType a5,
341 typename internal::CallbackParamTraits<A6>::ForwardType a6) { 341 typename internal::CallbackParamTraits<A6>::ForwardType a6) {
342 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 342 typename internal::CallbackListBase<CallbackType>::Iterator it =
343 this->GetIterator(); 343 this->GetIterator();
344 CallbackType* cb; 344 CallbackType* cb;
345 while((cb = it.GetNext()) != NULL) { 345 while((cb = it.GetNext()) != NULL) {
346 cb->Run(a1, a2, a3, a4, a5, a6); 346 cb->Run(a1, a2, a3, a4, a5, a6);
347 } 347 }
348 } 348 }
349 349
350 private: 350 private:
351 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 351 DISALLOW_COPY_AND_ASSIGN(CallbackList);
352 }; 352 };
353 353
354 template <typename A1, typename A2, typename A3, typename A4, typename A5, 354 template <typename A1, typename A2, typename A3, typename A4, typename A5,
355 typename A6, typename A7> 355 typename A6, typename A7>
356 class CallbackRegistry<void(A1, A2, A3, A4, A5, A6, A7)> 356 class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
357 : public internal::CallbackRegistryBase< 357 : public internal::CallbackListBase<
358 Callback<void(A1, A2, A3, A4, A5, A6, A7)> > { 358 Callback<void(A1, A2, A3, A4, A5, A6, A7)> > {
359 public: 359 public:
360 typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType; 360 typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType;
361 361
362 CallbackRegistry() {} 362 CallbackList() {}
363 363
364 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, 364 void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
365 typename internal::CallbackParamTraits<A2>::ForwardType a2, 365 typename internal::CallbackParamTraits<A2>::ForwardType a2,
366 typename internal::CallbackParamTraits<A3>::ForwardType a3, 366 typename internal::CallbackParamTraits<A3>::ForwardType a3,
367 typename internal::CallbackParamTraits<A4>::ForwardType a4, 367 typename internal::CallbackParamTraits<A4>::ForwardType a4,
368 typename internal::CallbackParamTraits<A5>::ForwardType a5, 368 typename internal::CallbackParamTraits<A5>::ForwardType a5,
369 typename internal::CallbackParamTraits<A6>::ForwardType a6, 369 typename internal::CallbackParamTraits<A6>::ForwardType a6,
370 typename internal::CallbackParamTraits<A7>::ForwardType a7) { 370 typename internal::CallbackParamTraits<A7>::ForwardType a7) {
371 typename internal::CallbackRegistryBase<CallbackType>::Iterator it = 371 typename internal::CallbackListBase<CallbackType>::Iterator it =
372 this->GetIterator(); 372 this->GetIterator();
373 CallbackType* cb; 373 CallbackType* cb;
374 while((cb = it.GetNext()) != NULL) { 374 while((cb = it.GetNext()) != NULL) {
375 cb->Run(a1, a2, a3, a4, a5, a6, a7); 375 cb->Run(a1, a2, a3, a4, a5, a6, a7);
376 } 376 }
377 } 377 }
378 378
379 private: 379 private:
380 DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); 380 DISALLOW_COPY_AND_ASSIGN(CallbackList);
381 }; 381 };
382 382
383 } // namespace base 383 } // namespace base
384 384
385 #endif // BASE_CALLBACK_REGISTRY_H 385 #endif // BASE_CALLBACK_LIST_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/callback_list.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698