| OLD | NEW |
| 1 $$ This is a pump file for generating file templates. Pump is a python | 1 $$ This is a pump file for generating file templates. Pump is a python |
| 2 $$ script that is part of the Google Test suite of utilities. Description | 2 $$ script that is part of the Google Test suite of utilities. Description |
| 3 $$ can be found here: | 3 $$ can be found here: |
| 4 $$ | 4 $$ |
| 5 $$ http://code.google.com/p/googletest/wiki/PumpManual | 5 $$ http://code.google.com/p/googletest/wiki/PumpManual |
| 6 $$ | 6 $$ |
| 7 | 7 |
| 8 $$ See comment for MAX_ARITY in base/bind.h.pump. | 8 $$ See comment for MAX_ARITY in base/bind.h.pump. |
| 9 $var MAX_ARITY = 7 | 9 $var MAX_ARITY = 7 |
| 10 | 10 |
| 11 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 11 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 12 // Use of this source code is governed by a BSD-style license that can be | 12 // Use of this source code is governed by a BSD-style license that can be |
| 13 // found in the LICENSE file. | 13 // found in the LICENSE file. |
| 14 | 14 |
| 15 #ifndef BASE_CALLBACK_H_ | 15 #ifndef BASE_CALLBACK_H_ |
| 16 #define BASE_CALLBACK_H_ | 16 #define BASE_CALLBACK_H_ |
| 17 #pragma once | 17 #pragma once |
| 18 | 18 |
| 19 #include "base/callback_forward.h" |
| 19 #include "base/callback_internal.h" | 20 #include "base/callback_internal.h" |
| 20 #include "base/template_util.h" | 21 #include "base/template_util.h" |
| 21 | 22 |
| 23 // NOTE: Header files that do not require the full definition of Callback or |
| 24 // Closure should #include "base/callback_forward.h" instead of this file. |
| 25 |
| 22 // New, super-duper, unified Callback system. This will eventually replace | 26 // New, super-duper, unified Callback system. This will eventually replace |
| 23 // NewRunnableMethod, NewRunnableFunction, CreateFunctor, and CreateCallback | 27 // NewRunnableMethod, NewRunnableFunction, CreateFunctor, and CreateCallback |
| 24 // systems currently in the Chromium code base. | 28 // systems currently in the Chromium code base. |
| 25 // | 29 // |
| 26 // WHAT IS THIS: | 30 // WHAT IS THIS: |
| 27 // | 31 // |
| 28 // The templated Callback class is a generalized function object. Together | 32 // The templated Callback class is a generalized function object. Together |
| 29 // with the Bind() function in bind.h, they provide a type-safe method for | 33 // with the Bind() function in bind.h, they provide a type-safe method for |
| 30 // performing currying of arguments, and creating a "closure." | 34 // performing currying of arguments, and creating a "closure." |
| 31 // | 35 // |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 231 |
| 228 namespace base { | 232 namespace base { |
| 229 | 233 |
| 230 // First, we forward declare the Callback class template. This informs the | 234 // First, we forward declare the Callback class template. This informs the |
| 231 // compiler that the template only has 1 type parameter which is the function | 235 // compiler that the template only has 1 type parameter which is the function |
| 232 // signature that the Callback is representing. | 236 // signature that the Callback is representing. |
| 233 // | 237 // |
| 234 // After this, create template specializations for 0-$(MAX_ARITY) parameters. No
te that | 238 // After this, create template specializations for 0-$(MAX_ARITY) parameters. No
te that |
| 235 // even though the template typelist grows, the specialization still | 239 // even though the template typelist grows, the specialization still |
| 236 // only has one type: the function signature. | 240 // only has one type: the function signature. |
| 241 // |
| 242 // If you are thinking of forward declaring Callback in your own header file, |
| 243 // please include "base/callback_forward.h" instead. |
| 237 template <typename Sig> | 244 template <typename Sig> |
| 238 class Callback; | 245 class Callback; |
| 239 | 246 |
| 240 | 247 |
| 241 $range ARITY 0..MAX_ARITY | 248 $range ARITY 0..MAX_ARITY |
| 242 $for ARITY [[ | 249 $for ARITY [[ |
| 243 $range ARG 1..ARITY | 250 $range ARG 1..ARITY |
| 244 | 251 |
| 245 $if ARITY == 0 [[ | 252 $if ARITY == 0 [[ |
| 246 template <typename R> | 253 template <typename R> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 305 |
| 299 ]] $$ for ARITY | 306 ]] $$ for ARITY |
| 300 | 307 |
| 301 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it | 308 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it |
| 302 // will be used in a lot of APIs with delayed execution. | 309 // will be used in a lot of APIs with delayed execution. |
| 303 typedef Callback<void(void)> Closure; | 310 typedef Callback<void(void)> Closure; |
| 304 | 311 |
| 305 } // namespace base | 312 } // namespace base |
| 306 | 313 |
| 307 #endif // BASE_CALLBACK_H | 314 #endif // BASE_CALLBACK_H |
| OLD | NEW |