diff options
Diffstat (limited to 'third_party/chromium/base/callback.h')
-rw-r--r-- | third_party/chromium/base/callback.h | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/third_party/chromium/base/callback.h b/third_party/chromium/base/callback.h index c04e90d..e087c73 100644 --- a/third_party/chromium/base/callback.h +++ b/third_party/chromium/base/callback.h @@ -187,8 +187,8 @@ // // PASSING PARAMETERS AS A scoped_ptr // -// void TakesOwnership(scoped_ptr<Foo> arg) {} -// scoped_ptr<Foo> f(new Foo); +// void TakesOwnership(std::unique_ptr<Foo> arg) {} +// std::unique_ptr<Foo> f(new Foo); // // f becomes null during the following call. // base::Closure cb = base::Bind(&TakesOwnership, base::Passed(&f)); // @@ -345,14 +345,13 @@ // please include "base/callback_forward.h" instead. namespace base { -namespace internal { -template <typename Runnable, typename RunType, typename... BoundArgsType> -struct BindState; -} // namespace internal template <typename R, typename... Args, internal::CopyMode copy_mode> class Callback<R(Args...), copy_mode> : public internal::CallbackBase<copy_mode> { + private: + using PolymorphicInvoke = R (*)(internal::BindStateBase*, Args&&...); + public: // MSVC 2013 doesn't support Type Alias of function types. // Revisit this after we update it to newer version. @@ -360,16 +359,9 @@ class Callback<R(Args...), copy_mode> Callback() : internal::CallbackBase<copy_mode>(nullptr) {} - template <typename Runnable, typename BindRunType, typename... BoundArgs> - explicit Callback( - internal::BindState<Runnable, BindRunType, BoundArgs...>* bind_state) + Callback(internal::BindStateBase* bind_state, + PolymorphicInvoke invoke_func) : internal::CallbackBase<copy_mode>(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &internal::BindState<Runnable, BindRunType, BoundArgs...> - ::InvokerType::Run; using InvokeFuncStorage = typename internal::CallbackBase<copy_mode>::InvokeFuncStorage; this->polymorphic_invoke_ = @@ -396,9 +388,6 @@ class Callback<R(Args...), copy_mode> reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke_); return f(this->bind_state_.get(), std::forward<Args>(args)...); } - - private: - using PolymorphicInvoke = R (*)(internal::BindStateBase*, Args&&...); }; } // namespace base |