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 e3c91191fe0fa1294d01edba511de1eab30e5758..10bf12d72f20ac2932ad9ddc504268cbf1514cdd 100644 |
--- a/third_party/WebKit/Source/wtf/TypeTraits.h |
+++ b/third_party/WebKit/Source/wtf/TypeTraits.h |
@@ -300,10 +300,23 @@ class IsGarbageCollectedType { |
char padding[8]; |
} NoType; |
+ static_assert(sizeof(T), "T must be fully defined"); |
+ |
+ using NonConstType = typename std::remove_const<T>::type; |
template <typename U> static YesType checkGarbageCollectedType(typename U::IsGarbageCollectedTypeMarker*); |
template <typename U> static NoType checkGarbageCollectedType(...); |
+ |
+ template <typename U> static YesType checkGarbageCollectedMixinType(typename U::IsGarbageCollectedMixinMarker*); |
+ template <typename U> static NoType checkGarbageCollectedMixinType(...); |
public: |
- static const bool value = (sizeof(YesType) == sizeof(checkGarbageCollectedType<T>(nullptr))); |
+ static const bool value = (sizeof(YesType) == sizeof(checkGarbageCollectedType<NonConstType>(nullptr))) |
+ || (sizeof(YesType) == sizeof(checkGarbageCollectedMixinType<NonConstType>(nullptr))); |
+}; |
+ |
+template<> |
+class IsGarbageCollectedType<void> { |
+public: |
+ static const bool value = false; |
}; |
template<typename T> |
@@ -319,17 +332,20 @@ public: |
static const bool value = (sizeof(YesType) == sizeof(checkPersistentReferenceType<T>(nullptr))); |
}; |
-template<typename T> |
+template<typename T, bool = std::is_function<typename std::remove_const<typename std::remove_pointer<T>::type>::type>::value || std::is_void<typename std::remove_const<typename std::remove_pointer<T>::type>::type>::value> |
class IsPointerToGarbageCollectedType { |
public: |
static const bool value = false; |
}; |
+ |
template<typename T> |
-class IsPointerToGarbageCollectedType<T*> { |
+class IsPointerToGarbageCollectedType<T*, false> { |
public: |
static const bool value = IsGarbageCollectedType<T>::value; |
}; |
} // namespace WTF |
+using WTF::IsGarbageCollectedType; |
+ |
#endif // TypeTraits_h |