diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-08-01 12:59:39 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-04 12:40:43 +0000 |
commit | 28b1110370900897ab652cb420c371fab8857ad4 (patch) | |
tree | 41b32127d23b0df4f2add2a27e12dc87bddb260e /chromium/base/bind.h | |
parent | 399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (diff) | |
download | qtwebengine-chromium-28b1110370900897ab652cb420c371fab8857ad4.tar.gz |
BASELINE: Update Chromium to 53.0.2785.41
Also adds a few extra files for extensions.
Change-Id: Iccdd55d98660903331cf8b7b29188da781830af4
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/base/bind.h')
-rw-r--r-- | chromium/base/bind.h | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/chromium/base/bind.h b/chromium/base/bind.h index 46dbb913bee..ed5a94a8c2f 100644 --- a/chromium/base/bind.h +++ b/chromium/base/bind.h @@ -46,47 +46,11 @@ namespace base { -namespace internal { - -// Don't use Alias Template directly here to avoid a compile error on MSVC2013. template <typename Functor, typename... Args> -struct MakeUnboundRunTypeImpl { - using Type = - typename BindState< - typename FunctorTraits<Functor>::RunnableType, - typename FunctorTraits<Functor>::RunType, - Args...>::UnboundRunType; -}; - -} // namespace internal - -template <typename Functor, typename... Args> -using MakeUnboundRunType = - typename internal::MakeUnboundRunTypeImpl<Functor, Args...>::Type; - -template <typename Functor, typename... Args> -base::Callback<MakeUnboundRunType<Functor, Args...>> +inline base::Callback<MakeUnboundRunType<Functor, Args...>> Bind(Functor functor, Args&&... args) { // Type aliases for how to store and run the functor. using RunnableType = typename internal::FunctorTraits<Functor>::RunnableType; - using RunType = typename internal::FunctorTraits<Functor>::RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks below for bound references need to know what the actual - // functor is going to interpret the argument as. - using BoundRunType = typename RunnableType::RunType; - - using BoundArgs = - internal::TakeTypeListItem<sizeof...(Args), - internal::ExtractArgs<BoundRunType>>; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - static_assert(!internal::HasNonConstReferenceItem<BoundArgs>::value, - "do not bind functions with nonconst ref"); const bool is_method = internal::HasIsMethodTag<RunnableType>::value; @@ -100,11 +64,14 @@ Bind(Functor functor, Args&&... args) { !internal::HasRefCountedParamAsRawPtr<is_method, Args...>::value, "a parameter is a refcounted type and needs scoped_refptr"); - using BindState = internal::BindState<RunnableType, RunType, Args...>; + using BindState = internal::BindState<RunnableType, Args...>; + using UnboundRunType = MakeUnboundRunType<Functor, Args...>; + using CallbackType = Callback<UnboundRunType>; + using Invoker = internal::Invoker<BindState, UnboundRunType>; - return Callback<typename BindState::UnboundRunType>( - new BindState(internal::MakeRunnable(functor), - std::forward<Args>(args)...)); + return CallbackType(new BindState(internal::MakeRunnable(functor), + std::forward<Args>(args)...), + &Invoker::Run); } } // namespace base |