Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: base/bind_internal.h

Issue 1644603003: Do Perfect Forwarding from base::Bind to BindState storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/bind.h ('k') | base/callback_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_internal.h
diff --git a/base/bind_internal.h b/base/bind_internal.h
index ac7cd0098787b97ba8d14d35bf068311fade086d..ce6b5d67c6e365e40fb707de03f926d2d1b0129d 100644
--- a/base/bind_internal.h
+++ b/base/bind_internal.h
@@ -104,7 +104,8 @@ template <bool is_method, typename... Args>
struct BindsArrayToFirstArg : false_type {};
template <typename T, typename... Args>
-struct BindsArrayToFirstArg<true, T, Args...> : is_array<T> {};
+struct BindsArrayToFirstArg<true, T, Args...>
+ : is_array<typename std::remove_reference<T>::type> {};
// HasRefCountedParamAsRawPtr is the same to HasRefCountedTypeAsRawPtr except
// when |is_method| is true HasRefCountedParamAsRawPtr skips the first argument.
@@ -401,11 +402,12 @@ struct BindState<Runnable, R(Args...), BoundArgs...> final
InvokeHelperType, UnboundForwardRunType>;
using UnboundRunType = MakeFunctionType<R, UnboundArgs>;
- BindState(const Runnable& runnable, const BoundArgs&... bound_args)
+ template <typename... ForwardArgs>
+ BindState(const Runnable& runnable, ForwardArgs&&... bound_args)
: BindStateBase(&Destroy),
runnable_(runnable),
ref_(bound_args...),
- bound_args_(bound_args...) {}
+ bound_args_(std::forward<ForwardArgs>(bound_args)...) {}
RunnableType runnable_;
MaybeScopedRefPtr<HasIsMethodTag<Runnable>::value, BoundArgs...> ref_;
« no previous file with comments | « base/bind.h ('k') | base/callback_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698