| Index: third_party/WebKit/Source/wtf/TypeTraits.h
|
| diff --git a/third_party/WebKit/Source/wtf/TypeTraits.h b/third_party/WebKit/Source/wtf/TypeTraits.h
|
| index 5a3cc98b910b2a4eb351dcda9432e0f27a6632eb..5d837a1dc7e28392f3c0c82f23b9eeb324962a11 100644
|
| --- a/third_party/WebKit/Source/wtf/TypeTraits.h
|
| +++ b/third_party/WebKit/Source/wtf/TypeTraits.h
|
| @@ -39,17 +39,6 @@ inline const char* getStringWithTypeName()
|
|
|
| template<typename T> class RawPtr;
|
|
|
| -// The following are provided in this file:
|
| -//
|
| -// IsConvertibleToInteger<T>::value
|
| -//
|
| -// IsSameType<T, U>::value
|
| -//
|
| -// static_assert's in TypeTraits.cpp illustrate their usage and what they do.
|
| -
|
| -template <bool Predicate, class T = void> struct EnableIf;
|
| -template <class T> struct EnableIf<true, T> { typedef T Type; };
|
| -
|
| template <typename T> struct IsWeak {
|
| static const bool value = false;
|
| };
|
| @@ -75,53 +64,6 @@ template <typename T> struct IsTriviallyDestructible {
|
| static const bool value = __has_trivial_destructor(T);
|
| };
|
|
|
| -template <typename T> class IsConvertibleToInteger {
|
| - // Avoid "possible loss of data" warning when using Microsoft's C++ compiler
|
| - // by not converting int's to doubles.
|
| - template <bool performCheck, typename U> class IsConvertibleToDouble;
|
| - template <typename U> class IsConvertibleToDouble<false, U> {
|
| - public:
|
| - static const bool value = false;
|
| - };
|
| -
|
| - template <typename U> class IsConvertibleToDouble<true, U> {
|
| - typedef char YesType;
|
| - struct NoType {
|
| - char padding[8];
|
| - };
|
| -
|
| - static YesType floatCheck(long double);
|
| - static NoType floatCheck(...);
|
| - static T& t;
|
| - public:
|
| - static const bool value = sizeof(floatCheck(t)) == sizeof(YesType);
|
| - };
|
| -
|
| -public:
|
| - static const bool value = std::is_integral<T>::value || IsConvertibleToDouble<!std::is_integral<T>::value, T>::value;
|
| -};
|
| -
|
| -template <typename T, typename U> struct IsSameType {
|
| - static const bool value = false;
|
| -};
|
| -
|
| -template <typename T> struct IsSameType<T, T> {
|
| - static const bool value = true;
|
| -};
|
| -
|
| -template <typename T, typename U> class IsSubclass {
|
| - typedef char YesType;
|
| - struct NoType {
|
| - char padding[8];
|
| - };
|
| -
|
| - static YesType subclassCheck(U*);
|
| - static NoType subclassCheck(...);
|
| - static T* t;
|
| -public:
|
| - static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
|
| -};
|
| -
|
| template <typename T, template <typename... V> class U> class IsSubclassOfTemplate {
|
| typedef char YesType;
|
| struct NoType {
|
| @@ -173,9 +115,9 @@ struct RemoveTemplate<OuterTemplate<T>, OuterTemplate> {
|
| typedef T Type;
|
| };
|
|
|
| -// Determines whether this type has a vtable.
|
| -template <typename T> struct IsPolymorphic {
|
| - static const bool value = __is_polymorphic(T);
|
| +template <typename T, typename U> class IsBaseOf {
|
| +public:
|
| + static const bool value = std::is_base_of<T, U>::value;
|
| };
|
|
|
| #if (COMPILER(MSVC) || !GCC_VERSION_AT_LEAST(4, 9, 0)) && !COMPILER(CLANG)
|
| @@ -186,27 +128,16 @@ template <typename T> struct IsPolymorphic {
|
| // However, MSVC checks for type completeness even if they are the same type.
|
| // Here, we use a template specialization for same type case to allow incomplete
|
| // types.
|
| -
|
| -template <typename T, typename U> class IsBaseOf {
|
| -public:
|
| - static const bool value = std::is_base_of<T, U>::value;
|
| -};
|
| -
|
| template <typename T> class IsBaseOf<T, T> {
|
| public:
|
| static const bool value = true;
|
| };
|
| +#endif
|
|
|
| #define EnsurePtrConvertibleArgDecl(From, To) \
|
| typename std::enable_if<WTF::IsBaseOf<To, From>::value>::type* = nullptr
|
| #define EnsurePtrConvertibleArgDefn(From, To) \
|
| typename std::enable_if<WTF::IsBaseOf<To, From>::value>::type*
|
| -#else
|
| -#define EnsurePtrConvertibleArgDecl(From, To) \
|
| - typename std::enable_if<std::is_base_of<To, From>::value>::type* = nullptr
|
| -#define EnsurePtrConvertibleArgDefn(From, To) \
|
| - typename std::enable_if<std::is_base_of<To, From>::value>::type*
|
| -#endif
|
|
|
| } // namespace WTF
|
|
|
| @@ -226,7 +157,7 @@ class NeedsTracing {
|
| } NoType;
|
|
|
| // Note that this also checks if a superclass of V has a trace method.
|
| - template <typename V> static YesType checkHasTraceMethod(V* v, blink::Visitor* p = nullptr, typename EnableIf<IsSameType<decltype(v->trace(p)), void>::value>::Type* g = nullptr);
|
| + template <typename V> static YesType checkHasTraceMethod(V* v, blink::Visitor* p = nullptr, typename std::enable_if<std::is_same<decltype(v->trace(p)), void>::value>::type* g = nullptr);
|
| template <typename V> static NoType checkHasTraceMethod(...);
|
| public:
|
| // We add sizeof(T) to both sides here, because we want it to fail for
|
|
|