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

Unified Diff: Source/platform/heap/Visitor.h

Issue 1007803004: Oilpan: consistently use IsGarbageCollectedMixin<> trait. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/modules/speech/SpeechRecognition.h ('k') | public/platform/WebPrivatePtr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index 8916300d089ab98b11e7d6e2f9c5ce9255c82432..a942162a9ea34d920ed21ec73c61ab5c3f2692e5 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -130,6 +130,23 @@ struct FinalizerTrait {
static void finalize(void* obj) { FinalizerTraitImpl<T, nonTrivialFinalizer>::finalize(obj); }
};
+// Template to determine if a class is a GarbageCollectedMixin by checking if it
+// has IsGarbageCollectedMixinMarker
+template<typename T>
+struct IsGarbageCollectedMixin {
+private:
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ template <typename U> static YesType checkMarker(typename U::IsGarbageCollectedMixinMarker*);
+ template <typename U> static NoType checkMarker(...);
+
+public:
+ static const bool value = sizeof(checkMarker<T>(nullptr)) == sizeof(YesType);
+};
+
// Trait to get the GCInfo structure for types that have their
// instances allocated in the Blink garbage-collected heap.
template<typename T> struct GCInfoTrait;
@@ -147,7 +164,7 @@ template <typename T> const bool NeedsAdjustAndMark<T, true>::value;
template<typename T>
class NeedsAdjustAndMark<T, false> {
public:
- static const bool value = WTF::IsSubclass<typename WTF::RemoveConst<T>::Type, GarbageCollectedMixin>::value;
+ static const bool value = IsGarbageCollectedMixin<typename WTF::RemoveConst<T>::Type>::value;
};
template <typename T> const bool NeedsAdjustAndMark<T, false>::value;
@@ -1042,23 +1059,6 @@ protected: \
#define WILL_BE_USING_GARBAGE_COLLECTED_MIXIN_NESTED(TYPE, NESTEDMIXIN)
#endif
-// Template to determine if a class is a GarbageCollectedMixin by checking if it
-// has IsGarbageCollectedMixinMarker
-template<typename T>
-struct IsGarbageCollectedMixin {
-private:
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- template <typename U> static YesType checkMarker(typename U::IsGarbageCollectedMixinMarker*);
- template <typename U> static NoType checkMarker(...);
-
-public:
- static const bool value = sizeof(checkMarker<T>(nullptr)) == sizeof(YesType);
-};
-
// An empty class with a constructor that's arranged invoked when all derived constructors
// of a mixin instance have completed and it is safe to allow GCs again. See
// AllocateObjectTrait<> comment for more.
« no previous file with comments | « Source/modules/speech/SpeechRecognition.h ('k') | public/platform/WebPrivatePtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698