Let PDFium handle event when there is not yet a visible page.
[chromium-blink-merge.git] / base / bind.h
blobb14f70c109f777ef78991990aedef270a2e82bc8
1 // This file was GENERATED by command:
2 // pump.py bind.h.pump
3 // DO NOT EDIT BY HAND!!!
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
8 // found in the LICENSE file.
10 #ifndef BASE_BIND_H_
11 #define BASE_BIND_H_
13 #include "base/bind_internal.h"
14 #include "base/callback_internal.h"
16 // -----------------------------------------------------------------------------
17 // Usage documentation
18 // -----------------------------------------------------------------------------
20 // See base/callback.h for documentation.
23 // -----------------------------------------------------------------------------
24 // Implementation notes
25 // -----------------------------------------------------------------------------
27 // If you're reading the implementation, before proceeding further, you should
28 // read the top comment of base/bind_internal.h for a definition of common
29 // terms and concepts.
31 // RETURN TYPES
33 // Though Bind()'s result is meant to be stored in a Callback<> type, it
34 // cannot actually return the exact type without requiring a large amount
35 // of extra template specializations. The problem is that in order to
36 // discern the correct specialization of Callback<>, Bind would need to
37 // unwrap the function signature to determine the signature's arity, and
38 // whether or not it is a method.
40 // Each unique combination of (arity, function_type, num_prebound) where
41 // function_type is one of {function, method, const_method} would require
42 // one specialization. We eventually have to do a similar number of
43 // specializations anyways in the implementation (see the Invoker<>,
44 // classes). However, it is avoidable in Bind if we return the result
45 // via an indirection like we do below.
47 // TODO(ajwong): We might be able to avoid this now, but need to test.
49 // It is possible to move most of the COMPILE_ASSERT asserts into BindState<>,
50 // but it feels a little nicer to have the asserts here so people do not
51 // need to crack open bind_internal.h. On the other hand, it makes Bind()
52 // harder to read.
54 namespace base {
56 template <typename Functor>
57 base::Callback<
58 typename internal::BindState<
59 typename internal::FunctorTraits<Functor>::RunnableType,
60 typename internal::FunctorTraits<Functor>::RunType,
61 void()>
62 ::UnboundRunType>
63 Bind(Functor functor) {
64 // Typedefs for how to store and run the functor.
65 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
66 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
68 typedef internal::BindState<RunnableType, RunType, void()> BindState;
71 return Callback<typename BindState::UnboundRunType>(
72 new BindState(internal::MakeRunnable(functor)));
75 template <typename Functor, typename P1>
76 base::Callback<
77 typename internal::BindState<
78 typename internal::FunctorTraits<Functor>::RunnableType,
79 typename internal::FunctorTraits<Functor>::RunType,
80 void(typename internal::CallbackParamTraits<P1>::StorageType)>
81 ::UnboundRunType>
82 Bind(Functor functor, const P1& p1) {
83 // Typedefs for how to store and run the functor.
84 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
85 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
87 // Use RunnableType::RunType instead of RunType above because our
88 // checks should below for bound references need to know what the actual
89 // functor is going to interpret the argument as.
90 typedef internal::FunctionTraits<typename RunnableType::RunType>
91 BoundFunctorTraits;
93 // Do not allow binding a non-const reference parameter. Non-const reference
94 // parameters are disallowed by the Google style guide. Also, binding a
95 // non-const reference parameter can make for subtle bugs because the
96 // invoked function will receive a reference to the stored copy of the
97 // argument and not the original.
98 COMPILE_ASSERT(
99 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ),
100 do_not_bind_functions_with_nonconst_ref);
102 // For methods, we need to be careful for parameter 1. We do not require
103 // a scoped_refptr because BindState<> itself takes care of AddRef() for
104 // methods. We also disallow binding of an array as the method's target
105 // object.
106 COMPILE_ASSERT(
107 internal::HasIsMethodTag<RunnableType>::value ||
108 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
109 p1_is_refcounted_type_and_needs_scoped_refptr);
110 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
111 !is_array<P1>::value,
112 first_bound_argument_to_method_cannot_be_array);
113 typedef internal::BindState<RunnableType, RunType,
114 void(typename internal::CallbackParamTraits<P1>::StorageType)> BindState;
117 return Callback<typename BindState::UnboundRunType>(
118 new BindState(internal::MakeRunnable(functor), p1));
121 template <typename Functor, typename P1, typename P2>
122 base::Callback<
123 typename internal::BindState<
124 typename internal::FunctorTraits<Functor>::RunnableType,
125 typename internal::FunctorTraits<Functor>::RunType,
126 void(typename internal::CallbackParamTraits<P1>::StorageType,
127 typename internal::CallbackParamTraits<P2>::StorageType)>
128 ::UnboundRunType>
129 Bind(Functor functor, const P1& p1, const P2& p2) {
130 // Typedefs for how to store and run the functor.
131 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
132 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
134 // Use RunnableType::RunType instead of RunType above because our
135 // checks should below for bound references need to know what the actual
136 // functor is going to interpret the argument as.
137 typedef internal::FunctionTraits<typename RunnableType::RunType>
138 BoundFunctorTraits;
140 // Do not allow binding a non-const reference parameter. Non-const reference
141 // parameters are disallowed by the Google style guide. Also, binding a
142 // non-const reference parameter can make for subtle bugs because the
143 // invoked function will receive a reference to the stored copy of the
144 // argument and not the original.
145 COMPILE_ASSERT(
146 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
147 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ),
148 do_not_bind_functions_with_nonconst_ref);
150 // For methods, we need to be careful for parameter 1. We do not require
151 // a scoped_refptr because BindState<> itself takes care of AddRef() for
152 // methods. We also disallow binding of an array as the method's target
153 // object.
154 COMPILE_ASSERT(
155 internal::HasIsMethodTag<RunnableType>::value ||
156 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
157 p1_is_refcounted_type_and_needs_scoped_refptr);
158 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
159 !is_array<P1>::value,
160 first_bound_argument_to_method_cannot_be_array);
161 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
162 p2_is_refcounted_type_and_needs_scoped_refptr);
163 typedef internal::BindState<RunnableType, RunType,
164 void(typename internal::CallbackParamTraits<P1>::StorageType,
165 typename internal::CallbackParamTraits<P2>::StorageType)> BindState;
168 return Callback<typename BindState::UnboundRunType>(
169 new BindState(internal::MakeRunnable(functor), p1, p2));
172 template <typename Functor, typename P1, typename P2, typename P3>
173 base::Callback<
174 typename internal::BindState<
175 typename internal::FunctorTraits<Functor>::RunnableType,
176 typename internal::FunctorTraits<Functor>::RunType,
177 void(typename internal::CallbackParamTraits<P1>::StorageType,
178 typename internal::CallbackParamTraits<P2>::StorageType,
179 typename internal::CallbackParamTraits<P3>::StorageType)>
180 ::UnboundRunType>
181 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3) {
182 // Typedefs for how to store and run the functor.
183 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
184 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
186 // Use RunnableType::RunType instead of RunType above because our
187 // checks should below for bound references need to know what the actual
188 // functor is going to interpret the argument as.
189 typedef internal::FunctionTraits<typename RunnableType::RunType>
190 BoundFunctorTraits;
192 // Do not allow binding a non-const reference parameter. Non-const reference
193 // parameters are disallowed by the Google style guide. Also, binding a
194 // non-const reference parameter can make for subtle bugs because the
195 // invoked function will receive a reference to the stored copy of the
196 // argument and not the original.
197 COMPILE_ASSERT(
198 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
199 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
200 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ),
201 do_not_bind_functions_with_nonconst_ref);
203 // For methods, we need to be careful for parameter 1. We do not require
204 // a scoped_refptr because BindState<> itself takes care of AddRef() for
205 // methods. We also disallow binding of an array as the method's target
206 // object.
207 COMPILE_ASSERT(
208 internal::HasIsMethodTag<RunnableType>::value ||
209 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
210 p1_is_refcounted_type_and_needs_scoped_refptr);
211 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
212 !is_array<P1>::value,
213 first_bound_argument_to_method_cannot_be_array);
214 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
215 p2_is_refcounted_type_and_needs_scoped_refptr);
216 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
217 p3_is_refcounted_type_and_needs_scoped_refptr);
218 typedef internal::BindState<RunnableType, RunType,
219 void(typename internal::CallbackParamTraits<P1>::StorageType,
220 typename internal::CallbackParamTraits<P2>::StorageType,
221 typename internal::CallbackParamTraits<P3>::StorageType)> BindState;
224 return Callback<typename BindState::UnboundRunType>(
225 new BindState(internal::MakeRunnable(functor), p1, p2, p3));
228 template <typename Functor, typename P1, typename P2, typename P3, typename P4>
229 base::Callback<
230 typename internal::BindState<
231 typename internal::FunctorTraits<Functor>::RunnableType,
232 typename internal::FunctorTraits<Functor>::RunType,
233 void(typename internal::CallbackParamTraits<P1>::StorageType,
234 typename internal::CallbackParamTraits<P2>::StorageType,
235 typename internal::CallbackParamTraits<P3>::StorageType,
236 typename internal::CallbackParamTraits<P4>::StorageType)>
237 ::UnboundRunType>
238 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4) {
239 // Typedefs for how to store and run the functor.
240 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
241 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
243 // Use RunnableType::RunType instead of RunType above because our
244 // checks should below for bound references need to know what the actual
245 // functor is going to interpret the argument as.
246 typedef internal::FunctionTraits<typename RunnableType::RunType>
247 BoundFunctorTraits;
249 // Do not allow binding a non-const reference parameter. Non-const reference
250 // parameters are disallowed by the Google style guide. Also, binding a
251 // non-const reference parameter can make for subtle bugs because the
252 // invoked function will receive a reference to the stored copy of the
253 // argument and not the original.
254 COMPILE_ASSERT(
255 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
256 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
257 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
258 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ),
259 do_not_bind_functions_with_nonconst_ref);
261 // For methods, we need to be careful for parameter 1. We do not require
262 // a scoped_refptr because BindState<> itself takes care of AddRef() for
263 // methods. We also disallow binding of an array as the method's target
264 // object.
265 COMPILE_ASSERT(
266 internal::HasIsMethodTag<RunnableType>::value ||
267 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
268 p1_is_refcounted_type_and_needs_scoped_refptr);
269 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
270 !is_array<P1>::value,
271 first_bound_argument_to_method_cannot_be_array);
272 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
273 p2_is_refcounted_type_and_needs_scoped_refptr);
274 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
275 p3_is_refcounted_type_and_needs_scoped_refptr);
276 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
277 p4_is_refcounted_type_and_needs_scoped_refptr);
278 typedef internal::BindState<RunnableType, RunType,
279 void(typename internal::CallbackParamTraits<P1>::StorageType,
280 typename internal::CallbackParamTraits<P2>::StorageType,
281 typename internal::CallbackParamTraits<P3>::StorageType,
282 typename internal::CallbackParamTraits<P4>::StorageType)> BindState;
285 return Callback<typename BindState::UnboundRunType>(
286 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4));
289 template <typename Functor, typename P1, typename P2, typename P3, typename P4,
290 typename P5>
291 base::Callback<
292 typename internal::BindState<
293 typename internal::FunctorTraits<Functor>::RunnableType,
294 typename internal::FunctorTraits<Functor>::RunType,
295 void(typename internal::CallbackParamTraits<P1>::StorageType,
296 typename internal::CallbackParamTraits<P2>::StorageType,
297 typename internal::CallbackParamTraits<P3>::StorageType,
298 typename internal::CallbackParamTraits<P4>::StorageType,
299 typename internal::CallbackParamTraits<P5>::StorageType)>
300 ::UnboundRunType>
301 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4,
302 const P5& p5) {
303 // Typedefs for how to store and run the functor.
304 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
305 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
307 // Use RunnableType::RunType instead of RunType above because our
308 // checks should below for bound references need to know what the actual
309 // functor is going to interpret the argument as.
310 typedef internal::FunctionTraits<typename RunnableType::RunType>
311 BoundFunctorTraits;
313 // Do not allow binding a non-const reference parameter. Non-const reference
314 // parameters are disallowed by the Google style guide. Also, binding a
315 // non-const reference parameter can make for subtle bugs because the
316 // invoked function will receive a reference to the stored copy of the
317 // argument and not the original.
318 COMPILE_ASSERT(
319 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
320 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
321 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
322 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
323 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ),
324 do_not_bind_functions_with_nonconst_ref);
326 // For methods, we need to be careful for parameter 1. We do not require
327 // a scoped_refptr because BindState<> itself takes care of AddRef() for
328 // methods. We also disallow binding of an array as the method's target
329 // object.
330 COMPILE_ASSERT(
331 internal::HasIsMethodTag<RunnableType>::value ||
332 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
333 p1_is_refcounted_type_and_needs_scoped_refptr);
334 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
335 !is_array<P1>::value,
336 first_bound_argument_to_method_cannot_be_array);
337 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
338 p2_is_refcounted_type_and_needs_scoped_refptr);
339 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
340 p3_is_refcounted_type_and_needs_scoped_refptr);
341 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
342 p4_is_refcounted_type_and_needs_scoped_refptr);
343 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
344 p5_is_refcounted_type_and_needs_scoped_refptr);
345 typedef internal::BindState<RunnableType, RunType,
346 void(typename internal::CallbackParamTraits<P1>::StorageType,
347 typename internal::CallbackParamTraits<P2>::StorageType,
348 typename internal::CallbackParamTraits<P3>::StorageType,
349 typename internal::CallbackParamTraits<P4>::StorageType,
350 typename internal::CallbackParamTraits<P5>::StorageType)> BindState;
353 return Callback<typename BindState::UnboundRunType>(
354 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4, p5));
357 template <typename Functor, typename P1, typename P2, typename P3, typename P4,
358 typename P5, typename P6>
359 base::Callback<
360 typename internal::BindState<
361 typename internal::FunctorTraits<Functor>::RunnableType,
362 typename internal::FunctorTraits<Functor>::RunType,
363 void(typename internal::CallbackParamTraits<P1>::StorageType,
364 typename internal::CallbackParamTraits<P2>::StorageType,
365 typename internal::CallbackParamTraits<P3>::StorageType,
366 typename internal::CallbackParamTraits<P4>::StorageType,
367 typename internal::CallbackParamTraits<P5>::StorageType,
368 typename internal::CallbackParamTraits<P6>::StorageType)>
369 ::UnboundRunType>
370 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4,
371 const P5& p5, const P6& p6) {
372 // Typedefs for how to store and run the functor.
373 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
374 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
376 // Use RunnableType::RunType instead of RunType above because our
377 // checks should below for bound references need to know what the actual
378 // functor is going to interpret the argument as.
379 typedef internal::FunctionTraits<typename RunnableType::RunType>
380 BoundFunctorTraits;
382 // Do not allow binding a non-const reference parameter. Non-const reference
383 // parameters are disallowed by the Google style guide. Also, binding a
384 // non-const reference parameter can make for subtle bugs because the
385 // invoked function will receive a reference to the stored copy of the
386 // argument and not the original.
387 COMPILE_ASSERT(
388 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
389 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
390 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
391 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
392 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ||
393 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value ),
394 do_not_bind_functions_with_nonconst_ref);
396 // For methods, we need to be careful for parameter 1. We do not require
397 // a scoped_refptr because BindState<> itself takes care of AddRef() for
398 // methods. We also disallow binding of an array as the method's target
399 // object.
400 COMPILE_ASSERT(
401 internal::HasIsMethodTag<RunnableType>::value ||
402 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
403 p1_is_refcounted_type_and_needs_scoped_refptr);
404 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
405 !is_array<P1>::value,
406 first_bound_argument_to_method_cannot_be_array);
407 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
408 p2_is_refcounted_type_and_needs_scoped_refptr);
409 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
410 p3_is_refcounted_type_and_needs_scoped_refptr);
411 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
412 p4_is_refcounted_type_and_needs_scoped_refptr);
413 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
414 p5_is_refcounted_type_and_needs_scoped_refptr);
415 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value,
416 p6_is_refcounted_type_and_needs_scoped_refptr);
417 typedef internal::BindState<RunnableType, RunType,
418 void(typename internal::CallbackParamTraits<P1>::StorageType,
419 typename internal::CallbackParamTraits<P2>::StorageType,
420 typename internal::CallbackParamTraits<P3>::StorageType,
421 typename internal::CallbackParamTraits<P4>::StorageType,
422 typename internal::CallbackParamTraits<P5>::StorageType,
423 typename internal::CallbackParamTraits<P6>::StorageType)> BindState;
426 return Callback<typename BindState::UnboundRunType>(
427 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6));
430 template <typename Functor, typename P1, typename P2, typename P3, typename P4,
431 typename P5, typename P6, typename P7>
432 base::Callback<
433 typename internal::BindState<
434 typename internal::FunctorTraits<Functor>::RunnableType,
435 typename internal::FunctorTraits<Functor>::RunType,
436 void(typename internal::CallbackParamTraits<P1>::StorageType,
437 typename internal::CallbackParamTraits<P2>::StorageType,
438 typename internal::CallbackParamTraits<P3>::StorageType,
439 typename internal::CallbackParamTraits<P4>::StorageType,
440 typename internal::CallbackParamTraits<P5>::StorageType,
441 typename internal::CallbackParamTraits<P6>::StorageType,
442 typename internal::CallbackParamTraits<P7>::StorageType)>
443 ::UnboundRunType>
444 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4,
445 const P5& p5, const P6& p6, const P7& p7) {
446 // Typedefs for how to store and run the functor.
447 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
448 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
450 // Use RunnableType::RunType instead of RunType above because our
451 // checks should below for bound references need to know what the actual
452 // functor is going to interpret the argument as.
453 typedef internal::FunctionTraits<typename RunnableType::RunType>
454 BoundFunctorTraits;
456 // Do not allow binding a non-const reference parameter. Non-const reference
457 // parameters are disallowed by the Google style guide. Also, binding a
458 // non-const reference parameter can make for subtle bugs because the
459 // invoked function will receive a reference to the stored copy of the
460 // argument and not the original.
461 COMPILE_ASSERT(
462 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value ||
463 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value ||
464 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value ||
465 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value ||
466 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value ||
467 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value ||
468 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value ),
469 do_not_bind_functions_with_nonconst_ref);
471 // For methods, we need to be careful for parameter 1. We do not require
472 // a scoped_refptr because BindState<> itself takes care of AddRef() for
473 // methods. We also disallow binding of an array as the method's target
474 // object.
475 COMPILE_ASSERT(
476 internal::HasIsMethodTag<RunnableType>::value ||
477 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value,
478 p1_is_refcounted_type_and_needs_scoped_refptr);
479 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
480 !is_array<P1>::value,
481 first_bound_argument_to_method_cannot_be_array);
482 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value,
483 p2_is_refcounted_type_and_needs_scoped_refptr);
484 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value,
485 p3_is_refcounted_type_and_needs_scoped_refptr);
486 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value,
487 p4_is_refcounted_type_and_needs_scoped_refptr);
488 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value,
489 p5_is_refcounted_type_and_needs_scoped_refptr);
490 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value,
491 p6_is_refcounted_type_and_needs_scoped_refptr);
492 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value,
493 p7_is_refcounted_type_and_needs_scoped_refptr);
494 typedef internal::BindState<RunnableType, RunType,
495 void(typename internal::CallbackParamTraits<P1>::StorageType,
496 typename internal::CallbackParamTraits<P2>::StorageType,
497 typename internal::CallbackParamTraits<P3>::StorageType,
498 typename internal::CallbackParamTraits<P4>::StorageType,
499 typename internal::CallbackParamTraits<P5>::StorageType,
500 typename internal::CallbackParamTraits<P6>::StorageType,
501 typename internal::CallbackParamTraits<P7>::StorageType)> BindState;
504 return Callback<typename BindState::UnboundRunType>(
505 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6,
506 p7));
509 } // namespace base
511 #endif // BASE_BIND_H_