| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 typename std::enable_if<IsWeakMethod<FunctorTraits<Functor>::is_method, | 404 typename std::enable_if<IsWeakMethod<FunctorTraits<Functor>::is_method, |
| 405 BoundArgs...>::value>::type> { | 405 BoundArgs...>::value>::type> { |
| 406 static constexpr bool is_cancellable = true; | 406 static constexpr bool is_cancellable = true; |
| 407 static bool Run(const BindStateBase* base) { | 407 static bool Run(const BindStateBase* base) { |
| 408 using BindStateType = BindState<Functor, BoundArgs...>; | 408 using BindStateType = BindState<Functor, BoundArgs...>; |
| 409 const BindStateType* bind_state = static_cast<const BindStateType*>(base); | 409 const BindStateType* bind_state = static_cast<const BindStateType*>(base); |
| 410 return !base::get<0>(bind_state->bound_args_); | 410 return !base::get<0>(bind_state->bound_args_); |
| 411 } | 411 } |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 template <typename Signature, typename... BoundArgs> | 414 template <typename Signature, |
| 415 struct CancellationChecker<BindState<Callback<Signature>, BoundArgs...>> { | 415 typename... BoundArgs, |
| 416 CopyMode copy_mode, |
| 417 RepeatMode repeat_mode> |
| 418 struct CancellationChecker< |
| 419 BindState<Callback<Signature, copy_mode, repeat_mode>, BoundArgs...>> { |
| 416 static constexpr bool is_cancellable = true; | 420 static constexpr bool is_cancellable = true; |
| 417 static bool Run(const BindStateBase* base) { | 421 static bool Run(const BindStateBase* base) { |
| 418 using Functor = Callback<Signature>; | 422 using Functor = Callback<Signature, copy_mode, repeat_mode>; |
| 419 using BindStateType = BindState<Functor, BoundArgs...>; | 423 using BindStateType = BindState<Functor, BoundArgs...>; |
| 420 const BindStateType* bind_state = static_cast<const BindStateType*>(base); | 424 const BindStateType* bind_state = static_cast<const BindStateType*>(base); |
| 421 return bind_state->functor_.IsCancelled(); | 425 return bind_state->functor_.IsCancelled(); |
| 422 } | 426 } |
| 423 }; | 427 }; |
| 424 | 428 |
| 425 // Template helpers to detect using Bind() on a base::Callback without any | 429 // Template helpers to detect using Bind() on a base::Callback without any |
| 426 // additional arguments. In that case, the original base::Callback object should | 430 // additional arguments. In that case, the original base::Callback object should |
| 427 // just be directly used. | 431 // just be directly used. |
| 428 template <typename Functor, typename... BoundArgs> | 432 template <typename Functor, typename... BoundArgs> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 549 |
| 546 // Returns a RunType of bound functor. | 550 // Returns a RunType of bound functor. |
| 547 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C). | 551 // E.g. MakeUnboundRunType<R(A, B, C), A, B> is evaluated to R(C). |
| 548 template <typename Functor, typename... BoundArgs> | 552 template <typename Functor, typename... BoundArgs> |
| 549 using MakeUnboundRunType = | 553 using MakeUnboundRunType = |
| 550 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type; | 554 typename internal::MakeUnboundRunTypeImpl<Functor, BoundArgs...>::Type; |
| 551 | 555 |
| 552 } // namespace base | 556 } // namespace base |
| 553 | 557 |
| 554 #endif // BASE_BIND_INTERNAL_H_ | 558 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |