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

Side by Side Diff: base/bind_internal.h

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « base/bind.h.pump ('k') | base/bind_internal.h.pump » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py bind_internal.h.pump 2 // pump.py bind_internal.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_BIND_INTERNAL_H_ 10 #ifndef BASE_BIND_INTERNAL_H_
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Handle the differing syntaxes needed for WeakPtr<> support, 67 // Handle the differing syntaxes needed for WeakPtr<> support,
68 // and for ignoring return values. This is separate from 68 // and for ignoring return values. This is separate from
69 // Invoker to avoid creating multiple version of Invoker<> 69 // Invoker to avoid creating multiple version of Invoker<>
70 // which grows at O(n^2) with the arity. 70 // which grows at O(n^2) with the arity.
71 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. 71 // Invoker<> -- Unwraps the curried parameters and executes the Runnable.
72 // There are |(ARITY^2 + ARITY)/2| Invoketypes. 72 // There are |(ARITY^2 + ARITY)/2| Invoketypes.
73 // BindState<> -- Stores the curried parameters, and is the main entry point 73 // BindState<> -- Stores the curried parameters, and is the main entry point
74 // into the Bind() system, doing most of the type resolution. 74 // into the Bind() system, doing most of the type resolution.
75 // There are ARITY BindState types. 75 // There are ARITY BindState types.
76 76
77 // HasNonConstReferenceParam selects true_type when any of the parameters in
78 // |Sig| is a non-const reference.
79 // Implementation note: This non-specialized case handles zero-arity case only.
80 // Non-zero-arity cases should be handled by the specialization below.
81 template <typename Sig>
82 struct HasNonConstReferenceParam : false_type {};
83
84 // Implementation note: Select true_type if the first parameter is a non-const
85 // reference. Otherwise, skip the first parameter and check rest of parameters
86 // recursively.
87 template <typename R, typename T, typename... Args>
88 struct HasNonConstReferenceParam<R(T, Args...)>
89 : SelectType<is_non_const_reference<T>::value,
90 true_type,
91 HasNonConstReferenceParam<R(Args...)>>::Type {};
92
93 // HasRefCountedTypeAsRawPtr selects true_type when any of the |Args| is a raw
94 // pointer to a RefCounted type.
95 // Implementation note: This non-specialized case handles zero-arity case only.
96 // Non-zero-arity cases should be handled by the specialization below.
97 template <typename... Args>
98 struct HasRefCountedTypeAsRawPtr : false_type {};
99
100 // Implementation note: Select true_type if the first parameter is a raw pointer
101 // to a RefCounted type. Otherwise, skip the first parameter and check rest of
102 // parameters recursively.
103 template <typename T, typename... Args>
104 struct HasRefCountedTypeAsRawPtr<T, Args...>
105 : SelectType<NeedsScopedRefptrButGetsRawPtr<T>::value,
106 true_type,
107 HasRefCountedTypeAsRawPtr<Args...>>::Type {};
108
109 // BindsArrayToFirstArg selects true_type when |is_method| is true and the first
110 // item of |Args| is an array type.
111 // Implementation note: This non-specialized case handles !is_method case and
112 // zero-arity case only. Other cases should be handled by the specialization
113 // below.
114 template <bool is_method, typename... Args>
115 struct BindsArrayToFirstArg : false_type {};
116
117 template <typename T, typename... Args>
118 struct BindsArrayToFirstArg<true, T, Args...> : is_array<T> {};
119
120 // HasRefCountedParamAsRawPtr is the same to HasRefCountedTypeAsRawPtr except
121 // when |is_method| is true HasRefCountedParamAsRawPtr skips the first argument.
122 // Implementation note: This non-specialized case handles !is_method case and
123 // zero-arity case only. Other cases should be handled by the specialization
124 // below.
125 template <bool is_method, typename... Args>
126 struct HasRefCountedParamAsRawPtr : HasRefCountedTypeAsRawPtr<Args...> {};
127
128 template <typename T, typename... Args>
129 struct HasRefCountedParamAsRawPtr<true, T, Args...>
130 : HasRefCountedTypeAsRawPtr<Args...> {};
131
77 // RunnableAdapter<> 132 // RunnableAdapter<>
78 // 133 //
79 // The RunnableAdapter<> templates provide a uniform interface for invoking 134 // The RunnableAdapter<> templates provide a uniform interface for invoking
80 // a function pointer, method pointer, or const method pointer. The adapter 135 // a function pointer, method pointer, or const method pointer. The adapter
81 // exposes a Run() method with an appropriate signature. Using this wrapper 136 // exposes a Run() method with an appropriate signature. Using this wrapper
82 // allows for writing code that supports all three pointer types without 137 // allows for writing code that supports all three pointer types without
83 // undue repetition. Without it, a lot of code would need to be repeated 3 138 // undue repetition. Without it, a lot of code would need to be repeated 3
84 // times. 139 // times.
85 // 140 //
86 // For method pointers and const method pointers the first argument to Run() 141 // For method pointers and const method pointers the first argument to Run()
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 P4 p4_; 2089 P4 p4_;
2035 P5 p5_; 2090 P5 p5_;
2036 P6 p6_; 2091 P6 p6_;
2037 P7 p7_; 2092 P7 p7_;
2038 }; 2093 };
2039 2094
2040 } // namespace internal 2095 } // namespace internal
2041 } // namespace base 2096 } // namespace base
2042 2097
2043 #endif // BASE_BIND_INTERNAL_H_ 2098 #endif // BASE_BIND_INTERNAL_H_
OLDNEW
« no previous file with comments | « base/bind.h.pump ('k') | base/bind_internal.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698