summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikhail.pozdnyakov <mikhail.pozdnyakov@intel.com>2015-12-31 05:39:19 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-31 13:40:37 +0000
commit1ccd19c09376043faf412a31b251c319e6f73e2f (patch)
treeef6a48fbccdb62b410cf33fe370148bf9f9e9a86
parentb0bb8262d7be1ef9d68e333a05d77e01f695ae44 (diff)
downloadchromium_src-1ccd19c09376043faf412a31b251c319e6f73e2f.zip
chromium_src-1ccd19c09376043faf412a31b251c319e6f73e2f.tar.gz
chromium_src-1ccd19c09376043faf412a31b251c319e6f73e2f.tar.bz2
more switching to standard type traits
The patch changes removes WTF type trais and changes the client code as following: WTF::EnableIf -> std::enable_if WTF::IsSameType -> std::is_same WTF::IsConvertibleTo.. -> std::is_convertible WTF::IsPolymorphic -> std::is_polymorphic BUG=554293 Review URL: https://codereview.chromium.org/1477213003 Cr-Commit-Position: refs/heads/master@{#367242}
-rw-r--r--third_party/WebKit/Source/core/css/CSSPrimitiveValue.h2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutTableSection.cpp4
-rw-r--r--third_party/WebKit/Source/platform/CrossThreadCopier.cpp16
-rw-r--r--third_party/WebKit/Source/platform/CrossThreadCopier.h8
-rw-r--r--third_party/WebKit/Source/platform/TraceEvent.h2
-rw-r--r--third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp6
-rw-r--r--third_party/WebKit/Source/platform/heap/GCInfo.h2
-rw-r--r--third_party/WebKit/Source/platform/heap/HeapAllocator.h4
-rw-r--r--third_party/WebKit/Source/platform/heap/TraceTraits.h4
-rw-r--r--third_party/WebKit/Source/platform/heap/Visitor.h2
-rw-r--r--third_party/WebKit/Source/wtf/CheckedArithmetic.h2
-rw-r--r--third_party/WebKit/Source/wtf/Deque.h2
-rw-r--r--third_party/WebKit/Source/wtf/HashTable.h4
-rw-r--r--third_party/WebKit/Source/wtf/LeakAnnotations.h2
-rw-r--r--third_party/WebKit/Source/wtf/TypeTraits.cpp35
-rw-r--r--third_party/WebKit/Source/wtf/TypeTraits.h52
-rw-r--r--third_party/WebKit/Source/wtf/Vector.h4
-rw-r--r--third_party/WebKit/Source/wtf/text/StringHash.h2
18 files changed, 34 insertions, 119 deletions
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
index a5cba2f..c261e61 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValue.h
@@ -198,7 +198,7 @@ public:
}
template<typename T> static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> create(T value)
{
- static_assert(!WTF::IsSameType<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead");
+ static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead");
return adoptRefWillBeNoop(new CSSPrimitiveValue(value));
}
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index baae67a..a8f3d77 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -80,8 +80,8 @@ row, const LayoutTableCell* cell)
void CellSpan::ensureConsistency(const unsigned maximumSpanSize)
{
- static_assert(WTF::IsSameType<decltype(m_start), unsigned>::value, "Asserts below assume m_start is unsigned");
- static_assert(WTF::IsSameType<decltype(m_end), unsigned>::value, "Asserts below assume m_end is unsigned");
+ static_assert(std::is_same<decltype(m_start), unsigned>::value, "Asserts below assume m_start is unsigned");
+ static_assert(std::is_same<decltype(m_end), unsigned>::value, "Asserts below assume m_end is unsigned");
RELEASE_ASSERT(m_start <= maximumSpanSize);
RELEASE_ASSERT(m_end <= maximumSpanSize);
RELEASE_ASSERT(m_start <= m_end);
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.cpp b/third_party/WebKit/Source/platform/CrossThreadCopier.cpp
index 367c124..a1d1190 100644
--- a/third_party/WebKit/Source/platform/CrossThreadCopier.cpp
+++ b/third_party/WebKit/Source/platform/CrossThreadCopier.cpp
@@ -69,17 +69,17 @@ CrossThreadCopierBase<false, false, false, ResourceResponse>::Type CrossThreadCo
class CopierThreadSafeRefCountedTest : public ThreadSafeRefCounted<CopierThreadSafeRefCountedTest> {
};
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
PassRefPtr<CopierThreadSafeRefCountedTest>,
CrossThreadCopier<PassRefPtr<CopierThreadSafeRefCountedTest>>::Type
>::value),
"PassRefPtr test");
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
PassRefPtr<CopierThreadSafeRefCountedTest>,
CrossThreadCopier<RefPtr<CopierThreadSafeRefCountedTest>>::Type
>::value),
"RefPtr test");
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
PassRefPtr<CopierThreadSafeRefCountedTest>,
CrossThreadCopier<CopierThreadSafeRefCountedTest*>::Type
>::value),
@@ -95,33 +95,33 @@ template<typename T> struct CrossThreadCopierBase<false, false, false, T> {
class CopierRefCountedTest : public RefCounted<CopierRefCountedTest> {
};
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
int,
CrossThreadCopier<PassRefPtr<CopierRefCountedTest>>::Type
>::value),
"PassRefPtr<RefCountedTest> test");
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
int,
CrossThreadCopier<RefPtr<CopierRefCountedTest>>::Type
>::value),
"RefPtr<RefCounted> test");
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
int,
CrossThreadCopier<CopierRefCountedTest*>::Type
>::value),
"Raw pointer RefCounted test");
// Verify that PassOwnPtr gets passed through.
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
PassOwnPtr<float>,
CrossThreadCopier<PassOwnPtr<float>>::Type
>::value),
"PassOwnPtr test");
// Verify that PassOwnPtr does not get passed through.
-static_assert((WTF::IsSameType<
+static_assert((std::is_same<
int,
CrossThreadCopier<OwnPtr<float>>::Type
>::value),
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.h b/third_party/WebKit/Source/platform/CrossThreadCopier.h
index 92e155e..af49e35 100644
--- a/third_party/WebKit/Source/platform/CrossThreadCopier.h
+++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -87,9 +87,9 @@ namespace blink {
typedef typename std::remove_pointer<TypeWithoutPassRefPtr>::type RefCountedType;
// Verify that only one of the above did a change.
- static_assert((WTF::IsSameType<RefPtr<RefCountedType>, T>::value
- || WTF::IsSameType<PassRefPtr<RefCountedType>, T>::value
- || WTF::IsSameType<RefCountedType*, T>::value),
+ static_assert((std::is_same<RefPtr<RefCountedType>, T>::value
+ || std::is_same<PassRefPtr<RefCountedType>, T>::value
+ || std::is_same<RefCountedType*, T>::value),
"only one type modification should be allowed");
typedef PassRefPtr<RefCountedType> Type;
@@ -184,7 +184,7 @@ namespace blink {
}
};
- template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase<WTF::IsConvertibleToInteger<T>::value,
+ template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase<std::is_convertible<T, int>::value,
WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type, ThreadSafeRefCounted>::value
|| WTF::IsSubclassOfTemplate<typename std::remove_pointer<T>::type, ThreadSafeRefCounted>::value
|| WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRefPtr>::Type, ThreadSafeRefCounted>::value,
diff --git a/third_party/WebKit/Source/platform/TraceEvent.h b/third_party/WebKit/Source/platform/TraceEvent.h
index 266ae7d..9a2b426 100644
--- a/third_party/WebKit/Source/platform/TraceEvent.h
+++ b/third_party/WebKit/Source/platform/TraceEvent.h
@@ -390,7 +390,7 @@ template<typename T> struct ConvertableToTraceFormatTraits {
};
template<typename T> struct ConvertableToTraceFormatTraits<PassRefPtr<T>> {
- static const bool isConvertable = WTF::IsSubclass<T, TraceEvent::ConvertableToTraceFormat>::value;
+ static const bool isConvertable = std::is_convertible<T*, TraceEvent::ConvertableToTraceFormat*>::value;
static PassRefPtr<ConvertableToTraceFormat> moveFromIfConvertable(const PassRefPtr<T>& convertableToTraceFormat)
{
return convertableToTraceFormat;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp b/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
index 5afe17d..656218b 100644
--- a/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainerTest.cpp
@@ -233,7 +233,7 @@ TEST(ContiguousContainerTest, ForwardIteration)
}
EXPECT_EQ(kNumElements, count);
- static_assert(WTF::IsSameType<decltype(*list.begin()), Point2D&>::value,
+ static_assert(std::is_same<decltype(*list.begin()), Point2D&>::value,
"Non-const iteration should produce non-const references.");
}
@@ -251,7 +251,7 @@ TEST(ContiguousContainerTest, ConstForwardIteration)
}
EXPECT_EQ(kNumElements, count);
- static_assert(WTF::IsSameType<decltype(*constList.begin()), const Point2D&>::value,
+ static_assert(std::is_same<decltype(*constList.begin()), const Point2D&>::value,
"Const iteration should produce const references.");
}
@@ -268,7 +268,7 @@ TEST(ContiguousContainerTest, ReverseIteration)
}
EXPECT_EQ(kNumElements, count);
- static_assert(WTF::IsSameType<decltype(*list.rbegin()), Point2D&>::value,
+ static_assert(std::is_same<decltype(*list.rbegin()), Point2D&>::value,
"Non-const iteration should produce non-const references.");
}
diff --git a/third_party/WebKit/Source/platform/heap/GCInfo.h b/third_party/WebKit/Source/platform/heap/GCInfo.h
index e054cd2..534370d 100644
--- a/third_party/WebKit/Source/platform/heap/GCInfo.h
+++ b/third_party/WebKit/Source/platform/heap/GCInfo.h
@@ -164,7 +164,7 @@ struct GCInfoAtBaseType {
TraceTrait<T>::trace,
FinalizerTrait<T>::finalize,
FinalizerTrait<T>::nonTrivialFinalizer,
- WTF::IsPolymorphic<T>::value,
+ std::is_polymorphic<T>::value,
#if ENABLE(DETAILED_MEMORY_INFRA)
TypenameStringTrait<T>::get
#endif
diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.h b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
index 259c46b..ea42c89 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -250,7 +250,7 @@ void HeapVectorBacking<T, Traits>::finalize(void* pointer)
{
static_assert(Traits::needsDestruction, "Only vector buffers with items requiring destruction should be finalized");
// See the comment in HeapVectorBacking::trace.
- static_assert(Traits::canClearUnusedSlotsWithMemset || WTF::IsPolymorphic<T>::value, "HeapVectorBacking doesn't support objects that cannot be cleared as unused with memset or don't have a vtable");
+ static_assert(Traits::canClearUnusedSlotsWithMemset || std::is_polymorphic<T>::value, "HeapVectorBacking doesn't support objects that cannot be cleared as unused with memset or don't have a vtable");
ASSERT(!WTF::IsTriviallyDestructible<T>::value);
HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer);
@@ -264,7 +264,7 @@ void HeapVectorBacking<T, Traits>::finalize(void* pointer)
// (which are already zeroed out).
ANNOTATE_CHANGE_SIZE(buffer, length, 0, length);
#endif
- if (WTF::IsPolymorphic<T>::value) {
+ if (std::is_polymorphic<T>::value) {
for (unsigned i = 0; i < length; ++i) {
if (blink::vTableInitialized(&buffer[i]))
buffer[i].~T();
diff --git a/third_party/WebKit/Source/platform/heap/TraceTraits.h b/third_party/WebKit/Source/platform/heap/TraceTraits.h
index e03a14a..7d35c32 100644
--- a/third_party/WebKit/Source/platform/heap/TraceTraits.h
+++ b/third_party/WebKit/Source/platform/heap/TraceTraits.h
@@ -385,7 +385,7 @@ struct TraceInCollectionTrait<NoWeakHandlingInCollections, strongify, blink::Hea
// This is fine because the fact that the object can be initialized
// with memset indicates that it is safe to treat the zerod slot
// as a valid object.
- static_assert(!NeedsTracingTrait<Traits>::value || Traits::canClearUnusedSlotsWithMemset || WTF::IsPolymorphic<T>::value, "HeapVectorBacking doesn't support objects that cannot be cleared as unused with memset.");
+ static_assert(!NeedsTracingTrait<Traits>::value || Traits::canClearUnusedSlotsWithMemset || std::is_polymorphic<T>::value, "HeapVectorBacking doesn't support objects that cannot be cleared as unused with memset.");
// This trace method is instantiated for vectors where
// NeedsTracingTrait<Traits>::value is false, but the trace method
@@ -399,7 +399,7 @@ struct TraceInCollectionTrait<NoWeakHandlingInCollections, strongify, blink::Hea
// Use the payload size as recorded by the heap to determine how many
// elements to trace.
size_t length = header->payloadSize() / sizeof(T);
- if (WTF::IsPolymorphic<T>::value) {
+ if (std::is_polymorphic<T>::value) {
for (size_t i = 0; i < length; ++i) {
if (blink::vTableInitialized(&array[i]))
blink::TraceIfEnabled<T, NeedsTracingTrait<Traits>::value>::trace(visitor, array[i]);
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h
index a32b7c9..f7d877e 100644
--- a/third_party/WebKit/Source/platform/heap/Visitor.h
+++ b/third_party/WebKit/Source/platform/heap/Visitor.h
@@ -187,7 +187,7 @@ public:
void trace(const T& t)
{
static_assert(sizeof(T), "T must be fully defined");
- if (WTF::IsPolymorphic<T>::value) {
+ if (std::is_polymorphic<T>::value) {
intptr_t vtable = *reinterpret_cast<const intptr_t*>(&t);
if (!vtable)
return;
diff --git a/third_party/WebKit/Source/wtf/CheckedArithmetic.h b/third_party/WebKit/Source/wtf/CheckedArithmetic.h
index 4ae1bbe..5b1c551 100644
--- a/third_party/WebKit/Source/wtf/CheckedArithmetic.h
+++ b/third_party/WebKit/Source/wtf/CheckedArithmetic.h
@@ -159,7 +159,7 @@ template <typename Target, typename Source> struct BoundsChecker<Target, Source,
}
};
-template <typename Target, typename Source, bool CanElide = IsSameType<Target, Source>::value || (sizeof(Target) > sizeof(Source)) > struct BoundsCheckElider;
+template <typename Target, typename Source, bool CanElide = std::is_same<Target, Source>::value || (sizeof(Target) > sizeof(Source)) > struct BoundsCheckElider;
template <typename Target, typename Source> struct BoundsCheckElider<Target, Source, true> {
static bool inBounds(Source) { return true; }
};
diff --git a/third_party/WebKit/Source/wtf/Deque.h b/third_party/WebKit/Source/wtf/Deque.h
index 062e610..eeae8e3 100644
--- a/third_party/WebKit/Source/wtf/Deque.h
+++ b/third_party/WebKit/Source/wtf/Deque.h
@@ -226,7 +226,7 @@ inline Deque<T, inlineCapacity, Allocator>::Deque()
: m_start(0)
, m_end(0)
{
- static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "Cannot initialize with memset if there is a vtable");
+ static_assert(!std::is_polymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "Cannot initialize with memset if there is a vtable");
#if ENABLE(OILPAN)
static_assert(Allocator::isGarbageCollected || !AllowsOnlyPlacementNew<T>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that have trace methods into an off-heap Deque");
#endif
diff --git a/third_party/WebKit/Source/wtf/HashTable.h b/third_party/WebKit/Source/wtf/HashTable.h
index 450f957..960ce29 100644
--- a/third_party/WebKit/Source/wtf/HashTable.h
+++ b/third_party/WebKit/Source/wtf/HashTable.h
@@ -995,10 +995,10 @@ Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Alloca
ValueType* result;
// Assert that we will not use memset on things with a vtable entry. The
// compiler will also check this on some platforms. We would like to check
- // this on the whole value (key-value pair), but IsPolymorphic will return
+ // this on the whole value (key-value pair), but std::is_polymorphic will return
// false for a pair of two types, even if one of the components is
// polymorphic.
- static_assert(!Traits::emptyValueIsZero || !IsPolymorphic<KeyType>::value, "empty value cannot be zero for things with a vtable");
+ static_assert(!Traits::emptyValueIsZero || !std::is_polymorphic<KeyType>::value, "empty value cannot be zero for things with a vtable");
#if ENABLE(OILPAN)
static_assert(Allocator::isGarbageCollected
diff --git a/third_party/WebKit/Source/wtf/LeakAnnotations.h b/third_party/WebKit/Source/wtf/LeakAnnotations.h
index 8dba581..c19e56d 100644
--- a/third_party/WebKit/Source/wtf/LeakAnnotations.h
+++ b/third_party/WebKit/Source/wtf/LeakAnnotations.h
@@ -103,7 +103,7 @@ class CanRegisterStaticLocalReference {
} NoType;
// Check if class T has public method "T* registerAsStaticReference()".
- template<typename V> static YesType checkHasRegisterAsStaticReferenceMethod(V* p, typename EnableIf<IsSubclass<V, typename std::remove_pointer<decltype(p->registerAsStaticReference())>::type>::value>::Type* = 0);
+ template<typename V> static YesType checkHasRegisterAsStaticReferenceMethod(V* p, typename std::enable_if<IsSubclass<V, typename std::remove_pointer<decltype(p->registerAsStaticReference())>::type>::value>::Type* = 0);
template<typename V> static NoType checkHasRegisterAsStaticReferenceMethod(...);
public:
diff --git a/third_party/WebKit/Source/wtf/TypeTraits.cpp b/third_party/WebKit/Source/wtf/TypeTraits.cpp
index ace2413..9b8c103 100644
--- a/third_party/WebKit/Source/wtf/TypeTraits.cpp
+++ b/third_party/WebKit/Source/wtf/TypeTraits.cpp
@@ -21,9 +21,7 @@
#include "wtf/TypeTraits.h"
-#include "wtf/Assertions.h"
#include "wtf/Noncopyable.h"
-#include <type_traits>
namespace WTF {
@@ -87,37 +85,6 @@ static_assert(!IsTriviallyCopyAssignable<NonCopyableClass>::value, "NonCopyableC
static_assert(IsTriviallyDefaultConstructible<NonCopyableClass>::value, "NonCopyableClass should have a trivial default constructor");
#endif // 0
-enum IsConvertibleToIntegerCheck { };
-static_assert(IsConvertibleToInteger<IsConvertibleToIntegerCheck>::value, "enum should be convertible to integer");
-static_assert(IsConvertibleToInteger<bool>::value, "bool should be convertible to integer");
-static_assert(IsConvertibleToInteger<char>::value, "char should be convertible to integer");
-static_assert(IsConvertibleToInteger<signed char>::value, "signed char should be convertible to integer");
-static_assert(IsConvertibleToInteger<unsigned char>::value, "unsigned char should be convertible to integer");
-static_assert(IsConvertibleToInteger<short>::value, "short should be convertible to integer");
-static_assert(IsConvertibleToInteger<unsigned short>::value, "unsigned short should be convertible to integer");
-static_assert(IsConvertibleToInteger<int>::value, "int should be convertible to integer");
-static_assert(IsConvertibleToInteger<unsigned>::value, "unsigned int should be convertible to integer");
-static_assert(IsConvertibleToInteger<long>::value, "long should be convertible to integer");
-static_assert(IsConvertibleToInteger<unsigned long>::value, "unsigned long should be convertible to integer");
-static_assert(IsConvertibleToInteger<long long>::value, "long long should be convertible to integer");
-static_assert(IsConvertibleToInteger<unsigned long long>::value, "unsigned long long should be convertible to integer");
-#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
-static_assert(IsConvertibleToInteger<wchar_t>::value, "whcar_t should be convertible to integer");
-#endif
-static_assert(IsConvertibleToInteger<double>::value, "double should be convertible to integer");
-static_assert(IsConvertibleToInteger<long double>::value, "long double should be convertible to integer");
-static_assert(IsConvertibleToInteger<float>::value, "float should be convertible to integer");
-static_assert(!IsConvertibleToInteger<char*>::value, "char* should not be convertible to integer");
-static_assert(!IsConvertibleToInteger<const char*>::value, "const char* should not be convertible to integer");
-static_assert(!IsConvertibleToInteger<volatile char*>::value, "volatile char* should not be convertible to integer");
-static_assert(!IsConvertibleToInteger<IsConvertibleToInteger<bool>>::value, "struct should not be convertible to integer");
-
-static_assert((IsSameType<bool, bool>::value), "bool should be the same type as itself");
-static_assert((IsSameType<int*, int*>::value), "int* should be the same type as itself");
-static_assert((!IsSameType<int, int*>::value), "int should not be the same type as int*");
-static_assert((!IsSameType<bool, const bool>::value), "T should not be the same type as const T");
-static_assert((!IsSameType<bool, volatile bool>::value), "T should not be the same type as volatile T");
-
template <typename T>
class TestBaseClass {
};
@@ -128,8 +95,6 @@ class TestDerivedClass : public TestBaseClass<int> {
static_assert((IsSubclass<TestDerivedClass, TestBaseClass<int>>::value), "Derived class should be a subclass of its base");
static_assert((!IsSubclass<TestBaseClass<int>, TestDerivedClass>::value), "Base class should not be a sublass of a derived class");
static_assert((IsSubclassOfTemplate<TestDerivedClass, TestBaseClass>::value), "Derived class should be a subclass of template from its base");
-static_assert((IsSameType<RemoveTemplate<TestBaseClass<int>, TestBaseClass>::Type, int>::value), "RemoveTemplate should remove the template typename from the type");
-static_assert((IsSameType<RemoveTemplate<int, TestBaseClass>::Type, int>::value), "RemoveTemplate should not alter non-template types");
typedef int IntArray[];
typedef int IntArraySized[4];
diff --git a/third_party/WebKit/Source/wtf/TypeTraits.h b/third_party/WebKit/Source/wtf/TypeTraits.h
index 5a3cc98..1d938b5 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,40 +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 {
@@ -173,11 +128,6 @@ 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);
-};
-
#if (COMPILER(MSVC) || !GCC_VERSION_AT_LEAST(4, 9, 0)) && !COMPILER(CLANG)
// FIXME: MSVC bug workaround. Remove once MSVC STL is fixed.
// FIXME: GCC before 4.9.0 seems to have the same issue.
@@ -226,7 +176,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
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h
index 46ada79..c9a2e659 100644
--- a/third_party/WebKit/Source/wtf/Vector.h
+++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -631,7 +631,7 @@ public:
Vector()
{
- static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "Cannot initialize with memset if there is a vtable");
+ static_assert(!std::is_polymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "Cannot initialize with memset if there is a vtable");
#if ENABLE(OILPAN)
static_assert(Allocator::isGarbageCollected || !AllowsOnlyPlacementNew<T>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that have trace methods into an off-heap Vector");
#endif
@@ -644,7 +644,7 @@ public:
explicit Vector(size_t size)
: Base(size)
{
- static_assert(!IsPolymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "Cannot initialize with memset if there is a vtable");
+ static_assert(!std::is_polymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "Cannot initialize with memset if there is a vtable");
#if ENABLE(OILPAN)
static_assert(Allocator::isGarbageCollected || !AllowsOnlyPlacementNew<T>::value || !NeedsTracing<T>::value, "Cannot put DISALLOW_NEW_EXCEPT_PLACEMENT_NEW objects that have trace methods into an off-heap Vector");
#endif
diff --git a/third_party/WebKit/Source/wtf/text/StringHash.h b/third_party/WebKit/Source/wtf/text/StringHash.h
index 1a4d927..d10554f 100644
--- a/third_party/WebKit/Source/wtf/text/StringHash.h
+++ b/third_party/WebKit/Source/wtf/text/StringHash.h
@@ -127,7 +127,7 @@ private:
// correctly-folded code point in all cases (see comment below).
template<typename T> static inline UChar foldCase(T ch)
{
- if (IsSameType<T, LChar>::value)
+ if (std::is_same<T, LChar>::value)
return StringImpl::latin1CaseFoldTable[ch];
// It's possible for WTF::Unicode::foldCase() to return a 32-bit value
// that's not representable as a UChar. However, since this is rare and