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

Side by Side Diff: base/bind_internal.h

Issue 1512833002: Remove unbound base::Bind overload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge back Created 5 years 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
« base/bind_helpers.h ('K') | « base/bind_helpers.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <type_traits> 8 #include <type_traits>
9 9
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Invoker<>. 64 // Invoker<>.
65 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. 65 // Invoker<> -- Unwraps the curried parameters and executes the Runnable.
66 // BindState<> -- Stores the curried parameters, and is the main entry point 66 // BindState<> -- Stores the curried parameters, and is the main entry point
67 // into the Bind() system, doing most of the type resolution. 67 // into the Bind() system, doing most of the type resolution.
68 // There are ARITY BindState types. 68 // There are ARITY BindState types.
69 69
70 // HasNonConstReferenceParam selects true_type when any of the parameters in 70 // HasNonConstReferenceParam selects true_type when any of the parameters in
71 // |Sig| is a non-const reference. 71 // |Sig| is a non-const reference.
72 // Implementation note: This non-specialized case handles zero-arity case only. 72 // Implementation note: This non-specialized case handles zero-arity case only.
73 // Non-zero-arity cases should be handled by the specialization below. 73 // Non-zero-arity cases should be handled by the specialization below.
74 template <typename Sig> 74 template <typename List>
75 struct HasNonConstReferenceParam : false_type {}; 75 struct HasNonConstReferenceItem : false_type {};
76 76
77 // Implementation note: Select true_type if the first parameter is a non-const 77 // Implementation note: Select true_type if the first parameter is a non-const
78 // reference. Otherwise, skip the first parameter and check rest of parameters 78 // reference. Otherwise, skip the first parameter and check rest of parameters
79 // recursively. 79 // recursively.
80 template <typename R, typename T, typename... Args> 80 template <typename T, typename... Args>
81 struct HasNonConstReferenceParam<R(T, Args...)> 81 struct HasNonConstReferenceItem<TypeList<T, Args...>>
dcheng 2015/12/14 19:26:46 I have a dumb question: why can't we just add a te
tzik 2015/12/15 05:55:09 Add specialization for R() and remove the base cas
82 : std::conditional<is_non_const_reference<T>::value, 82 : std::conditional<is_non_const_reference<T>::value,
83 true_type, 83 true_type,
84 HasNonConstReferenceParam<R(Args...)>>::type {}; 84 HasNonConstReferenceItem<TypeList<Args...>>>::type {};
85 85
86 // HasRefCountedTypeAsRawPtr selects true_type when any of the |Args| is a raw 86 // HasRefCountedTypeAsRawPtr selects true_type when any of the |Args| is a raw
87 // pointer to a RefCounted type. 87 // pointer to a RefCounted type.
88 // Implementation note: This non-specialized case handles zero-arity case only. 88 // Implementation note: This non-specialized case handles zero-arity case only.
89 // Non-zero-arity cases should be handled by the specialization below. 89 // Non-zero-arity cases should be handled by the specialization below.
90 template <typename... Args> 90 template <typename... Args>
91 struct HasRefCountedTypeAsRawPtr : false_type {}; 91 struct HasRefCountedTypeAsRawPtr : false_type {};
92 92
93 // Implementation note: Select true_type if the first parameter is a raw pointer 93 // Implementation note: Select true_type if the first parameter is a raw pointer
94 // to a RefCounted type. Otherwise, skip the first parameter and check rest of 94 // to a RefCounted type. Otherwise, skip the first parameter and check rest of
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 415
416 static void Destroy(BindStateBase* self) { 416 static void Destroy(BindStateBase* self) {
417 delete static_cast<BindState*>(self); 417 delete static_cast<BindState*>(self);
418 } 418 }
419 }; 419 };
420 420
421 } // namespace internal 421 } // namespace internal
422 } // namespace base 422 } // namespace base
423 423
424 #endif // BASE_BIND_INTERNAL_H_ 424 #endif // BASE_BIND_INTERNAL_H_
OLDNEW
« base/bind_helpers.h ('K') | « base/bind_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698