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

Unified Diff: base/bind.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 | « no previous file | base/bind_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind.h
diff --git a/base/bind.h b/base/bind.h
index 770e45706b02da7a041f4415bbd387f47f50e1e4..c6b73936a638229fc24b63e15435dcb7bf7c8258 100644
--- a/base/bind.h
+++ b/base/bind.h
@@ -6,7 +6,6 @@
#define BASE_BIND_H_
#include "base/bind_internal.h"
-#include "base/callback_internal.h"
// -----------------------------------------------------------------------------
// Usage documentation
@@ -52,9 +51,8 @@ base::Callback<
typename internal::BindState<
typename internal::FunctorTraits<Functor>::RunnableType,
typename internal::FunctorTraits<Functor>::RunType,
- typename internal::CallbackParamTraits<Args>::StorageType...>
- ::UnboundRunType>
-Bind(Functor functor, const Args&... args) {
+ typename std::decay<Args>::type...>::UnboundRunType>
+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;
@@ -89,11 +87,11 @@ Bind(Functor functor, const Args&... args) {
"a parameter is a refcounted type and needs scoped_refptr");
using BindState = internal::BindState<
- RunnableType, RunType,
- typename internal::CallbackParamTraits<Args>::StorageType...>;
+ RunnableType, RunType, typename std::decay<Args>::type...>;
return Callback<typename BindState::UnboundRunType>(
- new BindState(internal::MakeRunnable(functor), args...));
+ new BindState(internal::MakeRunnable(functor),
+ std::forward<Args>(args)...));
}
} // namespace base
« no previous file with comments | « no previous file | base/bind_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698