| Index: third_party/WebKit/Source/wtf/Functional.h
|
| diff --git a/third_party/WebKit/Source/wtf/Functional.h b/third_party/WebKit/Source/wtf/Functional.h
|
| index bdcff7c12602e8cfd6f35a9fb937b235663cc1e4..d4f6c45f6ac7dbdd26645207f2bdde2cbbf36344 100644
|
| --- a/third_party/WebKit/Source/wtf/Functional.h
|
| +++ b/third_party/WebKit/Source/wtf/Functional.h
|
| @@ -239,9 +239,6 @@ class Function<R(Args...), threadAffinity> {
|
| USING_FAST_MALLOC(Function);
|
| WTF_MAKE_NONCOPYABLE(Function);
|
| public:
|
| - Function(base::Callback<R(Args...)> callback)
|
| - : m_callback(std::move(callback)) { }
|
| -
|
| ~Function()
|
| {
|
| DCHECK(m_threadChecker.CalledOnValidThread());
|
| @@ -259,6 +256,22 @@ public:
|
| }
|
|
|
| private:
|
| + Function(base::Callback<R(Args...)> callback)
|
| + : m_callback(std::move(callback)) { }
|
| +
|
| + template <typename FunctionType, typename... BoundParameters>
|
| + static std::unique_ptr<Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, threadAffinity>> bindInternal(FunctionType function, BoundParameters&&... boundParameters)
|
| + {
|
| + using UnboundRunType = base::MakeUnboundRunType<FunctionType, BoundParameters...>;
|
| + return wrapUnique(new Function<UnboundRunType, threadAffinity>(base::Bind(function, typename ParamStorageTraits<typename std::decay<BoundParameters>::type>::StorageType(std::forward<BoundParameters>(boundParameters))...)));
|
| + }
|
| +
|
| + template <typename FunctionType, typename... BoundParameters>
|
| + friend std::unique_ptr<Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, SameThreadAffinity>> bind(FunctionType, BoundParameters&&...);
|
| +
|
| + template <typename FunctionType, typename... BoundParameters>
|
| + friend std::unique_ptr<Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, CrossThreadAffinity>> crossThreadBind(FunctionType, BoundParameters&&...);
|
| +
|
| using MaybeThreadChecker = typename std::conditional<
|
| threadAffinity == SameThreadAffinity,
|
| base::ThreadChecker,
|
| @@ -267,23 +280,16 @@ private:
|
| base::Callback<R(Args...)> m_callback;
|
| };
|
|
|
| -template <FunctionThreadAffinity threadAffinity, typename FunctionType, typename... BoundParameters>
|
| -std::unique_ptr<Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, threadAffinity>> bindInternal(FunctionType function, BoundParameters&&... boundParameters)
|
| -{
|
| - using UnboundRunType = base::MakeUnboundRunType<FunctionType, BoundParameters...>;
|
| - return wrapUnique(new Function<UnboundRunType, threadAffinity>(base::Bind(function, typename ParamStorageTraits<typename std::decay<BoundParameters>::type>::StorageType(std::forward<BoundParameters>(boundParameters))...)));
|
| -}
|
| -
|
| template <typename FunctionType, typename... BoundParameters>
|
| std::unique_ptr<Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, SameThreadAffinity>> bind(FunctionType function, BoundParameters&&... boundParameters)
|
| {
|
| - return bindInternal<SameThreadAffinity>(function, std::forward<BoundParameters>(boundParameters)...);
|
| + return Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, SameThreadAffinity>::bindInternal(function, std::forward<BoundParameters>(boundParameters)...);
|
| }
|
|
|
| template <typename FunctionType, typename... BoundParameters>
|
| std::unique_ptr<Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, CrossThreadAffinity>> crossThreadBind(FunctionType function, BoundParameters&&... boundParameters)
|
| {
|
| - return bindInternal<CrossThreadAffinity>(function, CrossThreadCopier<typename std::decay<BoundParameters>::type>::copy(std::forward<BoundParameters>(boundParameters))...);
|
| + return Function<base::MakeUnboundRunType<FunctionType, BoundParameters...>, CrossThreadAffinity>::bindInternal(function, CrossThreadCopier<typename std::decay<BoundParameters>::type>::copy(std::forward<BoundParameters>(boundParameters))...);
|
| }
|
|
|
| typedef Function<void(), SameThreadAffinity> Closure;
|
|
|