| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // | 42 // |
| 43 // EXAMPLE USAGE: | 43 // EXAMPLE USAGE: |
| 44 // | 44 // |
| 45 // /* Binding a normal function. */ | 45 // /* Binding a normal function. */ |
| 46 // int Return5() { return 5; } | 46 // int Return5() { return 5; } |
| 47 // base::Callback<int(void)> func_cb = base::Bind(&Return5); | 47 // base::Callback<int(void)> func_cb = base::Bind(&Return5); |
| 48 // LOG(INFO) << func_cb.Run(); // Prints 5. | 48 // LOG(INFO) << func_cb.Run(); // Prints 5. |
| 49 // | 49 // |
| 50 // void PrintHi() { LOG(INFO) << "hi."; } | 50 // void PrintHi() { LOG(INFO) << "hi."; } |
| 51 // base::Closure void_func_cb = base::Bind(&PrintHi); | 51 // base::Closure void_func_cb = base::Bind(&PrintHi); |
| 52 // LOG(INFO) << void_func_cb.Run(); // Prints: hi. | 52 // void_func_cb.Run(); // Prints: hi. |
| 53 // | 53 // |
| 54 // /* Binding a class method. */ | 54 // /* Binding a class method. */ |
| 55 // class Ref : public RefCountedThreadSafe<Ref> { | 55 // class Ref : public RefCountedThreadSafe<Ref> { |
| 56 // public: | 56 // public: |
| 57 // int Foo() { return 3; } | 57 // int Foo() { return 3; } |
| 58 // void PrintBye() { LOG(INFO) << "bye."; } | 58 // void PrintBye() { LOG(INFO) << "bye."; } |
| 59 // }; | 59 // }; |
| 60 // scoped_refptr<Ref> ref = new Ref(); | 60 // scoped_refptr<Ref> ref = new Ref(); |
| 61 // base::Callback<int(void)> ref_cb = base::Bind(&Ref::Foo, ref.get()); | 61 // base::Callback<int(void)> ref_cb = base::Bind(&Ref::Foo, ref.get()); |
| 62 // LOG(INFO) << ref_cb.Run(); // Prints out 3. | 62 // LOG(INFO) << ref_cb.Run(); // Prints out 3. |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 }; | 486 }; |
| 487 | 487 |
| 488 | 488 |
| 489 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it | 489 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it |
| 490 // will be used in a lot of APIs with delayed execution. | 490 // will be used in a lot of APIs with delayed execution. |
| 491 typedef Callback<void(void)> Closure; | 491 typedef Callback<void(void)> Closure; |
| 492 | 492 |
| 493 } // namespace base | 493 } // namespace base |
| 494 | 494 |
| 495 #endif // BASE_CALLBACK_H | 495 #endif // BASE_CALLBACK_H |
| OLD | NEW |