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

Side by Side Diff: base/callback.h

Issue 7780016: Make Callback.Equals() only work when comparing against the same type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing file. Created 9 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 | « base/bind_unittest.nc ('k') | base/callback.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.h.pump 2 // pump.py callback.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 5
6 6
7 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 7 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
8 // Use of this source code is governed by a BSD-style license that can be 8 // Use of this source code is governed by a BSD-style license that can be
9 // found in the LICENSE file. 9 // found in the LICENSE file.
10 10
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 template <typename T> 251 template <typename T>
252 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 252 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
253 : CallbackBase( 253 : CallbackBase(
254 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 254 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
255 &invoker_holder.invoker_storage_) { 255 &invoker_holder.invoker_storage_) {
256 COMPILE_ASSERT((is_same<PolymorphicInvoke, 256 COMPILE_ASSERT((is_same<PolymorphicInvoke,
257 typename T::Invoker::DoInvokeType>::value), 257 typename T::Invoker::DoInvokeType>::value),
258 callback_type_does_not_match_bind_result); 258 callback_type_does_not_match_bind_result);
259 } 259 }
260 260
261 bool Equals(const Callback& other) const {
262 return CallbackBase::Equals(other);
263 }
264
261 R Run() const { 265 R Run() const {
262 PolymorphicInvoke f = 266 PolymorphicInvoke f =
263 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 267 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
264 268
265 return f(invoker_storage_.get()); 269 return f(invoker_storage_.get());
266 } 270 }
267 }; 271 };
268 272
269 template <typename R, typename A1> 273 template <typename R, typename A1>
270 class Callback<R(A1)> : public internal::CallbackBase { 274 class Callback<R(A1)> : public internal::CallbackBase {
(...skipping 14 matching lines...) Expand all
285 template <typename T> 289 template <typename T>
286 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 290 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
287 : CallbackBase( 291 : CallbackBase(
288 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 292 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
289 &invoker_holder.invoker_storage_) { 293 &invoker_holder.invoker_storage_) {
290 COMPILE_ASSERT((is_same<PolymorphicInvoke, 294 COMPILE_ASSERT((is_same<PolymorphicInvoke,
291 typename T::Invoker::DoInvokeType>::value), 295 typename T::Invoker::DoInvokeType>::value),
292 callback_type_does_not_match_bind_result); 296 callback_type_does_not_match_bind_result);
293 } 297 }
294 298
299 bool Equals(const Callback& other) const {
300 return CallbackBase::Equals(other);
301 }
302
295 R Run(typename internal::ParamTraits<A1>::ForwardType a1) const { 303 R Run(typename internal::ParamTraits<A1>::ForwardType a1) const {
296 PolymorphicInvoke f = 304 PolymorphicInvoke f =
297 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 305 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
298 306
299 return f(invoker_storage_.get(), a1); 307 return f(invoker_storage_.get(), a1);
300 } 308 }
301 }; 309 };
302 310
303 template <typename R, typename A1, typename A2> 311 template <typename R, typename A1, typename A2>
304 class Callback<R(A1, A2)> : public internal::CallbackBase { 312 class Callback<R(A1, A2)> : public internal::CallbackBase {
(...skipping 15 matching lines...) Expand all
320 template <typename T> 328 template <typename T>
321 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 329 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
322 : CallbackBase( 330 : CallbackBase(
323 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 331 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
324 &invoker_holder.invoker_storage_) { 332 &invoker_holder.invoker_storage_) {
325 COMPILE_ASSERT((is_same<PolymorphicInvoke, 333 COMPILE_ASSERT((is_same<PolymorphicInvoke,
326 typename T::Invoker::DoInvokeType>::value), 334 typename T::Invoker::DoInvokeType>::value),
327 callback_type_does_not_match_bind_result); 335 callback_type_does_not_match_bind_result);
328 } 336 }
329 337
338 bool Equals(const Callback& other) const {
339 return CallbackBase::Equals(other);
340 }
341
330 R Run(typename internal::ParamTraits<A1>::ForwardType a1, 342 R Run(typename internal::ParamTraits<A1>::ForwardType a1,
331 typename internal::ParamTraits<A2>::ForwardType a2) const { 343 typename internal::ParamTraits<A2>::ForwardType a2) const {
332 PolymorphicInvoke f = 344 PolymorphicInvoke f =
333 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 345 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
334 346
335 return f(invoker_storage_.get(), a1, 347 return f(invoker_storage_.get(), a1,
336 a2); 348 a2);
337 } 349 }
338 }; 350 };
339 351
(...skipping 18 matching lines...) Expand all
358 template <typename T> 370 template <typename T>
359 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 371 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
360 : CallbackBase( 372 : CallbackBase(
361 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 373 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
362 &invoker_holder.invoker_storage_) { 374 &invoker_holder.invoker_storage_) {
363 COMPILE_ASSERT((is_same<PolymorphicInvoke, 375 COMPILE_ASSERT((is_same<PolymorphicInvoke,
364 typename T::Invoker::DoInvokeType>::value), 376 typename T::Invoker::DoInvokeType>::value),
365 callback_type_does_not_match_bind_result); 377 callback_type_does_not_match_bind_result);
366 } 378 }
367 379
380 bool Equals(const Callback& other) const {
381 return CallbackBase::Equals(other);
382 }
383
368 R Run(typename internal::ParamTraits<A1>::ForwardType a1, 384 R Run(typename internal::ParamTraits<A1>::ForwardType a1,
369 typename internal::ParamTraits<A2>::ForwardType a2, 385 typename internal::ParamTraits<A2>::ForwardType a2,
370 typename internal::ParamTraits<A3>::ForwardType a3) const { 386 typename internal::ParamTraits<A3>::ForwardType a3) const {
371 PolymorphicInvoke f = 387 PolymorphicInvoke f =
372 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 388 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
373 389
374 return f(invoker_storage_.get(), a1, 390 return f(invoker_storage_.get(), a1,
375 a2, 391 a2,
376 a3); 392 a3);
377 } 393 }
(...skipping 21 matching lines...) Expand all
399 template <typename T> 415 template <typename T>
400 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 416 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
401 : CallbackBase( 417 : CallbackBase(
402 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 418 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
403 &invoker_holder.invoker_storage_) { 419 &invoker_holder.invoker_storage_) {
404 COMPILE_ASSERT((is_same<PolymorphicInvoke, 420 COMPILE_ASSERT((is_same<PolymorphicInvoke,
405 typename T::Invoker::DoInvokeType>::value), 421 typename T::Invoker::DoInvokeType>::value),
406 callback_type_does_not_match_bind_result); 422 callback_type_does_not_match_bind_result);
407 } 423 }
408 424
425 bool Equals(const Callback& other) const {
426 return CallbackBase::Equals(other);
427 }
428
409 R Run(typename internal::ParamTraits<A1>::ForwardType a1, 429 R Run(typename internal::ParamTraits<A1>::ForwardType a1,
410 typename internal::ParamTraits<A2>::ForwardType a2, 430 typename internal::ParamTraits<A2>::ForwardType a2,
411 typename internal::ParamTraits<A3>::ForwardType a3, 431 typename internal::ParamTraits<A3>::ForwardType a3,
412 typename internal::ParamTraits<A4>::ForwardType a4) const { 432 typename internal::ParamTraits<A4>::ForwardType a4) const {
413 PolymorphicInvoke f = 433 PolymorphicInvoke f =
414 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 434 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
415 435
416 return f(invoker_storage_.get(), a1, 436 return f(invoker_storage_.get(), a1,
417 a2, 437 a2,
418 a3, 438 a3,
(...skipping 25 matching lines...) Expand all
444 template <typename T> 464 template <typename T>
445 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 465 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
446 : CallbackBase( 466 : CallbackBase(
447 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 467 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
448 &invoker_holder.invoker_storage_) { 468 &invoker_holder.invoker_storage_) {
449 COMPILE_ASSERT((is_same<PolymorphicInvoke, 469 COMPILE_ASSERT((is_same<PolymorphicInvoke,
450 typename T::Invoker::DoInvokeType>::value), 470 typename T::Invoker::DoInvokeType>::value),
451 callback_type_does_not_match_bind_result); 471 callback_type_does_not_match_bind_result);
452 } 472 }
453 473
474 bool Equals(const Callback& other) const {
475 return CallbackBase::Equals(other);
476 }
477
454 R Run(typename internal::ParamTraits<A1>::ForwardType a1, 478 R Run(typename internal::ParamTraits<A1>::ForwardType a1,
455 typename internal::ParamTraits<A2>::ForwardType a2, 479 typename internal::ParamTraits<A2>::ForwardType a2,
456 typename internal::ParamTraits<A3>::ForwardType a3, 480 typename internal::ParamTraits<A3>::ForwardType a3,
457 typename internal::ParamTraits<A4>::ForwardType a4, 481 typename internal::ParamTraits<A4>::ForwardType a4,
458 typename internal::ParamTraits<A5>::ForwardType a5) const { 482 typename internal::ParamTraits<A5>::ForwardType a5) const {
459 PolymorphicInvoke f = 483 PolymorphicInvoke f =
460 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 484 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
461 485
462 return f(invoker_storage_.get(), a1, 486 return f(invoker_storage_.get(), a1,
463 a2, 487 a2,
(...skipping 28 matching lines...) Expand all
492 template <typename T> 516 template <typename T>
493 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) 517 Callback(const internal::InvokerStorageHolder<T>& invoker_holder)
494 : CallbackBase( 518 : CallbackBase(
495 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), 519 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke),
496 &invoker_holder.invoker_storage_) { 520 &invoker_holder.invoker_storage_) {
497 COMPILE_ASSERT((is_same<PolymorphicInvoke, 521 COMPILE_ASSERT((is_same<PolymorphicInvoke,
498 typename T::Invoker::DoInvokeType>::value), 522 typename T::Invoker::DoInvokeType>::value),
499 callback_type_does_not_match_bind_result); 523 callback_type_does_not_match_bind_result);
500 } 524 }
501 525
526 bool Equals(const Callback& other) const {
527 return CallbackBase::Equals(other);
528 }
529
502 R Run(typename internal::ParamTraits<A1>::ForwardType a1, 530 R Run(typename internal::ParamTraits<A1>::ForwardType a1,
503 typename internal::ParamTraits<A2>::ForwardType a2, 531 typename internal::ParamTraits<A2>::ForwardType a2,
504 typename internal::ParamTraits<A3>::ForwardType a3, 532 typename internal::ParamTraits<A3>::ForwardType a3,
505 typename internal::ParamTraits<A4>::ForwardType a4, 533 typename internal::ParamTraits<A4>::ForwardType a4,
506 typename internal::ParamTraits<A5>::ForwardType a5, 534 typename internal::ParamTraits<A5>::ForwardType a5,
507 typename internal::ParamTraits<A6>::ForwardType a6) const { 535 typename internal::ParamTraits<A6>::ForwardType a6) const {
508 PolymorphicInvoke f = 536 PolymorphicInvoke f =
509 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); 537 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
510 538
511 return f(invoker_storage_.get(), a1, 539 return f(invoker_storage_.get(), a1,
512 a2, 540 a2,
513 a3, 541 a3,
514 a4, 542 a4,
515 a5, 543 a5,
516 a6); 544 a6);
517 } 545 }
518 }; 546 };
519 547
520 548
521 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it 549 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it
522 // will be used in a lot of APIs with delayed execution. 550 // will be used in a lot of APIs with delayed execution.
523 typedef Callback<void(void)> Closure; 551 typedef Callback<void(void)> Closure;
524 552
525 } // namespace base 553 } // namespace base
526 554
527 #endif // BASE_CALLBACK_H 555 #endif // BASE_CALLBACK_H
OLDNEW
« no previous file with comments | « base/bind_unittest.nc ('k') | base/callback.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698