| 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 6 // Copyright (c) 2011 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_H_ | 10 #ifndef BASE_CALLBACK_H_ |
| 11 #define BASE_CALLBACK_H_ | 11 #define BASE_CALLBACK_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include "base/callback_forward.h" |
| 14 #include "base/callback_internal.h" | 15 #include "base/callback_internal.h" |
| 15 #include "base/template_util.h" | 16 #include "base/template_util.h" |
| 16 | 17 |
| 18 // NOTE: Header files that do not require the full definition of Callback or |
| 19 // Closure should #include "base/callback_forward.h" instead of this file. |
| 20 |
| 17 // New, super-duper, unified Callback system. This will eventually replace | 21 // New, super-duper, unified Callback system. This will eventually replace |
| 18 // NewRunnableMethod, NewRunnableFunction, CreateFunctor, and CreateCallback | 22 // NewRunnableMethod, NewRunnableFunction, CreateFunctor, and CreateCallback |
| 19 // systems currently in the Chromium code base. | 23 // systems currently in the Chromium code base. |
| 20 // | 24 // |
| 21 // WHAT IS THIS: | 25 // WHAT IS THIS: |
| 22 // | 26 // |
| 23 // The templated Callback class is a generalized function object. Together | 27 // The templated Callback class is a generalized function object. Together |
| 24 // with the Bind() function in bind.h, they provide a type-safe method for | 28 // with the Bind() function in bind.h, they provide a type-safe method for |
| 25 // performing currying of arguments, and creating a "closure." | 29 // performing currying of arguments, and creating a "closure." |
| 26 // | 30 // |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 226 |
| 223 namespace base { | 227 namespace base { |
| 224 | 228 |
| 225 // First, we forward declare the Callback class template. This informs the | 229 // First, we forward declare the Callback class template. This informs the |
| 226 // compiler that the template only has 1 type parameter which is the function | 230 // compiler that the template only has 1 type parameter which is the function |
| 227 // signature that the Callback is representing. | 231 // signature that the Callback is representing. |
| 228 // | 232 // |
| 229 // After this, create template specializations for 0-7 parameters. Note that | 233 // After this, create template specializations for 0-7 parameters. Note that |
| 230 // even though the template typelist grows, the specialization still | 234 // even though the template typelist grows, the specialization still |
| 231 // only has one type: the function signature. | 235 // only has one type: the function signature. |
| 236 // |
| 237 // If you are thinking of forward declaring Callback in your own header file, |
| 238 // please include "base/callback_forward.h" instead. |
| 232 template <typename Sig> | 239 template <typename Sig> |
| 233 class Callback; | 240 class Callback; |
| 234 | 241 |
| 235 template <typename R> | 242 template <typename R> |
| 236 class Callback<R(void)> : public internal::CallbackBase { | 243 class Callback<R(void)> : public internal::CallbackBase { |
| 237 public: | 244 public: |
| 238 typedef R(RunType)(); | 245 typedef R(RunType)(); |
| 239 | 246 |
| 240 Callback() : CallbackBase(NULL, NULL) { } | 247 Callback() : CallbackBase(NULL, NULL) { } |
| 241 | 248 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 }; | 641 }; |
| 635 | 642 |
| 636 | 643 |
| 637 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it | 644 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it |
| 638 // will be used in a lot of APIs with delayed execution. | 645 // will be used in a lot of APIs with delayed execution. |
| 639 typedef Callback<void(void)> Closure; | 646 typedef Callback<void(void)> Closure; |
| 640 | 647 |
| 641 } // namespace base | 648 } // namespace base |
| 642 | 649 |
| 643 #endif // BASE_CALLBACK_H | 650 #endif // BASE_CALLBACK_H |
| OLD | NEW |