summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-30 17:16:53 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-06-13 16:41:06 +0200
commit45ec841f28d919ded66945c888024d12f9d7eebd (patch)
treefc85f0faf971c7ccc50385ed70cf689429e06219
parent06d572ebf4947483ad556db7232a22c76fcf38d7 (diff)
downloadqtwebengine-chromium-45ec841f28d919ded66945c888024d12f9d7eebd.tar.gz
[Revert] Remove base::internal::PassingTraits
This simplification doesn't work on MSVC due to some MSVC bug, so stick with the old version for now. Reverting https://chromium-review.googlesource.com/1118061 Change-Id: I3dff6075f9cc37dcc39c26b4f24de0501c8a362f Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--chromium/base/bind_internal.h5
-rw-r--r--chromium/base/callback.h4
-rw-r--r--chromium/base/callback_internal.h15
3 files changed, 19 insertions, 5 deletions
diff --git a/chromium/base/bind_internal.h b/chromium/base/bind_internal.h
index bf4a51b5a83..85fcc50a58a 100644
--- a/chromium/base/bind_internal.h
+++ b/chromium/base/bind_internal.h
@@ -631,7 +631,7 @@ struct Invoker;
template <typename StorageType, typename R, typename... UnboundArgs>
struct Invoker<StorageType, R(UnboundArgs...)> {
static R RunOnce(BindStateBase* base,
- PassingType<UnboundArgs>... unbound_args) {
+ PassingTraitsType<UnboundArgs>... unbound_args) {
// Local references to make debugger stepping easier. If in a debugger,
// you really want to warp ahead and step through the
// InvokeHelper<>::MakeItSo() call below.
@@ -644,7 +644,8 @@ struct Invoker<StorageType, R(UnboundArgs...)> {
std::forward<UnboundArgs>(unbound_args)...);
}
- static R Run(BindStateBase* base, PassingType<UnboundArgs>... unbound_args) {
+ static R Run(BindStateBase* base,
+ PassingTraitsType<UnboundArgs>... unbound_args) {
// Local references to make debugger stepping easier. If in a debugger,
// you really want to warp ahead and step through the
// InvokeHelper<>::MakeItSo() call below.
diff --git a/chromium/base/callback.h b/chromium/base/callback.h
index 4aad5e8ee5d..0e462bd3d57 100644
--- a/chromium/base/callback.h
+++ b/chromium/base/callback.h
@@ -57,7 +57,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
public:
using RunType = R(Args...);
using PolymorphicInvoke = R (*)(internal::BindStateBase*,
- internal::PassingType<Args>...);
+ internal::PassingTraitsType<Args>...);
constexpr OnceCallback() = default;
OnceCallback(std::nullptr_t) = delete;
@@ -103,7 +103,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
public:
using RunType = R(Args...);
using PolymorphicInvoke = R (*)(internal::BindStateBase*,
- internal::PassingType<Args>...);
+ internal::PassingTraitsType<Args>...);
constexpr RepeatingCallback() = default;
RepeatingCallback(std::nullptr_t) = delete;
diff --git a/chromium/base/callback_internal.h b/chromium/base/callback_internal.h
index 07c3dc4985d..97b7b629394 100644
--- a/chromium/base/callback_internal.h
+++ b/chromium/base/callback_internal.h
@@ -31,8 +31,21 @@ struct BindStateBaseRefCountTraits {
static void Destruct(const BindStateBase*);
};
+template <typename T, bool IsScalar = std::is_scalar<T>::value>
+struct PassingTraits;
+
+template <typename T>
+struct PassingTraits<T, false> {
+ using Type = T&&;
+};
+
+template <typename T>
+struct PassingTraits<T, true> {
+ using Type = T;
+};
+
template <typename T>
-using PassingType = std::conditional_t<std::is_scalar<T>::value, T, T&&>;
+using PassingTraitsType = typename PassingTraits<T>::Type;
// BindStateBase is used to provide an opaque handle that the Callback
// class can use to represent a function object with bound arguments. It