Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/GarbageCollected.h |
| diff --git a/third_party/WebKit/Source/platform/heap/GarbageCollected.h b/third_party/WebKit/Source/platform/heap/GarbageCollected.h |
| index eb6c3166de979c5cbe027b516b2758ab1b0d8096..c05abff58da025f331a6613547eaa912b0fa8ca5 100644 |
| --- a/third_party/WebKit/Source/platform/heap/GarbageCollected.h |
| +++ b/third_party/WebKit/Source/platform/heap/GarbageCollected.h |
| @@ -14,7 +14,6 @@ namespace blink { |
| template <typename T> |
| class GarbageCollected; |
| -class TraceWrapperBase; |
| // GC_PLUGIN_IGNORE is used to make the plugin ignore a particular class or |
| // field when checking for proper usage. When using GC_PLUGIN_IGNORE |
| @@ -247,25 +246,20 @@ class NeedsAdjustAndMark<T, false> { |
| IsGarbageCollectedMixin<typename std::remove_const<T>::type>::value; |
| }; |
| -template <typename T, |
| - bool = std::is_base_of<TraceWrapperBase, |
| - typename std::remove_const<T>::type>::value> |
| -class CanTraceWrappers; |
| - |
| template <typename T> |
| -class CanTraceWrappers<T, true> { |
| - static_assert(sizeof(T), "T must be fully defined"); |
| - |
| - public: |
| - static const bool value = true; |
| -}; |
| +class CanTraceWrappers { |
|
jbroman
2017/03/07 17:46:09
nit: Slightly more concisely (and happens to also
jbroman
2017/03/07 17:47:38
Err, replace "HasFoo" with "CanTraceWrappers". For
adithyas
2017/03/07 18:40:46
Much better, thanks!
|
| + typedef char YesType; |
| + typedef long NoType; |
| -template <typename T> |
| -class CanTraceWrappers<T, false> { |
| - static_assert(sizeof(T), "T must be fully defined"); |
| + template <typename U> |
| + static YesType TypeHasMarkAndDispatchTraceWrappers( |
| + decltype(&U::markAndDispatchTraceWrappers) *); |
| + template <typename U> |
| + static NoType TypeHasMarkAndDispatchTraceWrappers(...); |
| public: |
| - static const bool value = false; |
| + static bool const value = |
|
jbroman
2017/03/07 17:46:09
nit: If you do keep this, prefer "const bool" to "
|
| + (sizeof(TypeHasMarkAndDispatchTraceWrappers<T>(0)) == sizeof(YesType)); |
| }; |
| // TODO(sof): migrate to wtf/TypeTraits.h |