| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_BIND_INTERNAL_H_ | 5 #ifndef BASE_BIND_INTERNAL_H_ |
| 6 #define BASE_BIND_INTERNAL_H_ | 6 #define BASE_BIND_INTERNAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it. | 57 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it. |
| 58 // Handle the differing syntaxes needed for WeakPtr<> | 58 // Handle the differing syntaxes needed for WeakPtr<> |
| 59 // support, and for ignoring return values. This is separate | 59 // support, and for ignoring return values. This is separate |
| 60 // from Invoker to avoid creating multiple version of | 60 // from Invoker to avoid creating multiple version of |
| 61 // Invoker<>. | 61 // Invoker<>. |
| 62 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. | 62 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. |
| 63 // BindState<> -- Stores the curried parameters, and is the main entry point | 63 // BindState<> -- Stores the curried parameters, and is the main entry point |
| 64 // into the Bind() system, doing most of the type resolution. | 64 // into the Bind() system, doing most of the type resolution. |
| 65 // There are ARITY BindState types. | 65 // There are ARITY BindState types. |
| 66 | 66 |
| 67 // HasNonConstReferenceParam selects true_type when any of the parameters in | |
| 68 // |Sig| is a non-const reference. | |
| 69 // Implementation note: This non-specialized case handles zero-arity case only. | |
| 70 // Non-zero-arity cases should be handled by the specialization below. | |
| 71 template <typename List> | |
| 72 struct HasNonConstReferenceItem : std::false_type {}; | |
| 73 | |
| 74 // Implementation note: Select true_type if the first parameter is a non-const | |
| 75 // reference. Otherwise, skip the first parameter and check rest of parameters | |
| 76 // recursively. | |
| 77 template <typename T, typename... Args> | |
| 78 struct HasNonConstReferenceItem<TypeList<T, Args...>> | |
| 79 : std::conditional<is_non_const_reference<T>::value, | |
| 80 std::true_type, | |
| 81 HasNonConstReferenceItem<TypeList<Args...>>>::type {}; | |
| 82 | |
| 83 // HasRefCountedTypeAsRawPtr selects true_type when any of the |Args| is a raw | 67 // HasRefCountedTypeAsRawPtr selects true_type when any of the |Args| is a raw |
| 84 // pointer to a RefCounted type. | 68 // pointer to a RefCounted type. |
| 85 // Implementation note: This non-specialized case handles zero-arity case only. | 69 // Implementation note: This non-specialized case handles zero-arity case only. |
| 86 // Non-zero-arity cases should be handled by the specialization below. | 70 // Non-zero-arity cases should be handled by the specialization below. |
| 87 template <typename... Args> | 71 template <typename... Args> |
| 88 struct HasRefCountedTypeAsRawPtr : std::false_type {}; | 72 struct HasRefCountedTypeAsRawPtr : std::false_type {}; |
| 89 | 73 |
| 90 // Implementation note: Select true_type if the first parameter is a raw pointer | 74 // Implementation note: Select true_type if the first parameter is a raw pointer |
| 91 // to a RefCounted type. Otherwise, skip the first parameter and check rest of | 75 // to a RefCounted type. Otherwise, skip the first parameter and check rest of |
| 92 // parameters recursively. | 76 // parameters recursively. |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 433 |
| 450 // Returns a RunType of bound functor. | 434 // Returns a RunType of bound functor. |
| 451 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C). | 435 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C). |
| 452 template <typename Functor, typename... BoundArgs> | 436 template <typename Functor, typename... BoundArgs> |
| 453 using MakeUnboundRunType = | 437 using MakeUnboundRunType = |
| 454 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type; | 438 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type; |
| 455 | 439 |
| 456 } // namespace base | 440 } // namespace base |
| 457 | 441 |
| 458 #endif // BASE_BIND_INTERNAL_H_ | 442 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |