diff options
author | tzik <tzik@chromium.org> | 2016-02-02 20:42:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-03 04:43:28 +0000 |
commit | 0e9150fda9ea8d072b74c2580e47279c1073a650 (patch) | |
tree | d3853ff7266197cd38cdcc086a0bfbf49d190554 /base/bind_internal.h | |
parent | 37cf30324d0fcfc3e79646b9c110c0f5ca589d0a (diff) | |
download | chromium_src-0e9150fda9ea8d072b74c2580e47279c1073a650.zip chromium_src-0e9150fda9ea8d072b74c2580e47279c1073a650.tar.gz chromium_src-0e9150fda9ea8d072b74c2580e47279c1073a650.tar.bz2 |
Reland of Do Perfect Forwarding from base::Bind to BindState storage (patchset #1 id:1 of https://codereview.chromium.org/1654973003/ )
Reason for revert:
An size_t to uint32_t implicit conversion causes a compile error, which was fixed separately as http://crrev.com/f246b3224a5371fb
Original issue's description:
> Revert of Do Perfect Forwarding from base::Bind to BindState storage (patchset #2 id:20001 of https://codereview.chromium.org/1644603003/ )
>
> Reason for revert:
> This CL broke Windows build at an instantiation for:
> e:\b\build\slave\win_x64_gn__dbg_\build\src\components\mus\gles2\command_buffer_local.cc(195)
>
> The error message is:
> e:\b\build\slave\win_x64_gn__dbg_\build\src\base\bind_internal.h(291) : warning C4267: 'argument' : conversion from 'size_t' to 'const uint32_t', possible loss of data
>
> https://build.chromium.org/p/chromium.win/builders/Win%20x64%20GN%20%28dbg%29/builds/17854/steps/compile/logs/stdio
>
> Original issue's description:
> > Do Perfect Forwarding from base::Bind to BindState storage
> >
> > Replace StorageType usage with std::decay and do Perfect Forwarding from
> > base::Bind to BindState storage as a preparation to store a move-only
> > type into BindState.
> >
> > The difference of StorageType and std::decay is essentially array
> > handling. CallbackParamTraits::StorageType converts "T[n]" to "const T*"
> > OTOH std::decay converts it to "T*".
> >
> > BUG=554299
> >
> > Committed: https://crrev.com/cdec75e36dd5ec9c5643f7b473e166a3acef81ea
> > Cr-Commit-Position: refs/heads/master@{#372900}
>
> TBR=danakj@chromium.org,thakis@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=554299
>
> Committed: https://crrev.com/582cbf4e94a9a53f73ba5125de0d70afadc300ad
> Cr-Commit-Position: refs/heads/master@{#372903}
TBR=danakj@chromium.org,thakis@chromium.org
BUG=554299
Review URL: https://codereview.chromium.org/1660833002
Cr-Commit-Position: refs/heads/master@{#373172}
Diffstat (limited to 'base/bind_internal.h')
-rw-r--r-- | base/bind_internal.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/base/bind_internal.h b/base/bind_internal.h index ac7cd00..ce6b5d6 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_; |