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 <type_traits> | 8 #include <type_traits> |
9 | 9 |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 // This stores all the state passed into Bind() and is also where most | 355 // This stores all the state passed into Bind() and is also where most |
356 // of the template resolution magic occurs. | 356 // of the template resolution magic occurs. |
357 // | 357 // |
358 // Runnable is the functor we are binding arguments to. | 358 // Runnable is the functor we are binding arguments to. |
359 // RunType is type of the Run() function that the Invoker<> should use. | 359 // RunType is type of the Run() function that the Invoker<> should use. |
360 // Normally, this is the same as the RunType of the Runnable, but it can | 360 // Normally, this is the same as the RunType of the Runnable, but it can |
361 // be different if an adapter like IgnoreResult() has been used. | 361 // be different if an adapter like IgnoreResult() has been used. |
362 // | 362 // |
363 // BoundArgsType contains the storage type for all the bound arguments by | 363 // BoundArgsType contains the storage type for all the bound arguments by |
364 // (ab)using a function type. | 364 // (ab)using a function type. |
365 template <typename Runnable, typename RunType, typename BoundArgList> | 365 template <typename Runnable, typename RunType, typename... BoundArg> |
dcheng
2015/12/08 20:16:46
This should be BoundArgs since there may be more t
tzik
2015/12/09 07:03:15
Done. Also, removed the obsolete comments from lin
| |
366 struct BindState; | 366 struct BindState; |
367 | 367 |
368 template <typename Runnable, | 368 template <typename Runnable, |
369 typename R, | 369 typename R, |
370 typename... Args, | 370 typename... Args, |
371 typename... BoundArgs> | 371 typename... BoundArgs> |
372 struct BindState<Runnable, R(Args...), TypeList<BoundArgs...>> final | 372 struct BindState<Runnable, R(Args...), BoundArgs...> final |
373 : public BindStateBase { | 373 : public BindStateBase { |
374 private: | 374 private: |
375 using StorageType = BindState<Runnable, R(Args...), TypeList<BoundArgs...>>; | 375 using StorageType = BindState<Runnable, R(Args...), BoundArgs...>; |
376 using RunnableType = Runnable; | 376 using RunnableType = Runnable; |
377 | 377 |
378 // true_type if Runnable is a method invocation and the first bound argument | 378 // true_type if Runnable is a method invocation and the first bound argument |
379 // is a WeakPtr. | 379 // is a WeakPtr. |
380 using IsWeakCall = | 380 using IsWeakCall = |
381 IsWeakMethod<HasIsMethodTag<Runnable>::value, BoundArgs...>; | 381 IsWeakMethod<HasIsMethodTag<Runnable>::value, BoundArgs...>; |
382 | 382 |
383 using BoundIndices = MakeIndexSequence<sizeof...(BoundArgs)>; | 383 using BoundIndices = MakeIndexSequence<sizeof...(BoundArgs)>; |
384 using Unwrappers = TypeList<UnwrapTraits<BoundArgs>...>; | 384 using Unwrappers = TypeList<UnwrapTraits<BoundArgs>...>; |
385 using UnboundForwardArgs = DropTypeListItem< | 385 using UnboundForwardArgs = DropTypeListItem< |
(...skipping 29 matching lines...) Expand all Loading... | |
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_ |
OLD | NEW |