Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: third_party/WebKit/Source/platform/heap/GarbageCollected.h

Issue 2728203002: Remove WRAPPER_VISITOR_SPECIAL_CLASSES (Closed)
Patch Set: Add macro and update documentation Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698