Chromium Code Reviews| 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 1878058ca3129b6ea492b1fc958633ff409a2d0b..668524afa15d22ae4782823109cf9bac0181d6b9 100644 |
| --- a/third_party/WebKit/Source/wtf/Functional.h |
| +++ b/third_party/WebKit/Source/wtf/Functional.h |
| @@ -60,12 +60,12 @@ namespace WTF { |
| // 1) Pass by rvalue reference. |
| // |
| // void yourFunction(Argument&& argument) { ... } |
| -// OwnPtr<Function<void(Argument&&)>> functor = bind<Argument&&>(yourFunction); |
| +// std::unique_ptr<Function<void(Argument&&)>> functor = bind<Argument&&>(yourFunction); |
| // |
| // 2) Pass by value. |
| // |
| // void yourFunction(Argument argument) { ... } |
| -// OwnPtr<Function<void(Argument)>> functor = bind<Argument>(yourFunction); |
| +// std::unique_ptr<Function<void(Argument)>> functor = bind<Argument>(yourFunction); |
| // |
| // Note that with the latter there will be *two* move constructions happening, because there needs to be at least one |
| // intermediary function call taking an argument of type "Argument" (i.e. passed by value). The former case does not |
| @@ -84,7 +84,7 @@ namespace WTF { |
| // } |
| // |
| // ... |
| -// OwnPtr<Function<void()>> functor = bind(yourFunction, passed(Argument())); |
| +// std::unique_ptr<Function<void()>> functor = bind(yourFunction, passed(Argument())); |
| // ... |
| // (*functor)(); |
| // |
| @@ -166,6 +166,12 @@ public: |
| } |
| template <typename... IncomingParameters> |
| + R operator()(std::unique_ptr<C> c, IncomingParameters&&... parameters) |
|
tzik
2016/05/13 08:16:46
Can we use const-ref for |c|?
hiroshige
2016/05/13 08:42:28
Done.
|
| + { |
| + return (c.get()->*m_function)(std::forward<IncomingParameters>(parameters)...); |
| + } |
| + |
| + template <typename... IncomingParameters> |
| R operator()(const WeakPtr<C>& c, IncomingParameters&&... parameters) |
| { |
| C* obj = c.get(); |