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

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

Issue 322343002: Oilpan: Fix ParamStorageTraits for RawPtr<T>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « no previous file | Source/platform/heap/HeapTest.cpp » ('j') | Source/platform/heap/HeapTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Handle.h
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
index d4768b0b68ba5f17e0c5613b2d6dad3f17f6dc71..2653f6393a88fcc34d435b14b7a442cbe7ea6853 100644
--- a/Source/platform/heap/Handle.h
+++ b/Source/platform/heap/Handle.h
@@ -69,31 +69,34 @@ struct IsGarbageCollectedMixin {
static bool const value = (sizeof(TrueType) == sizeof(hasAdjustAndMark<T>(0))) && (sizeof(TrueType) == sizeof(hasIsAlive<T>(0)));
};
-#define COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, ErrorMessage) \
- do { \
- typedef typename WTF::RemoveConst<T>::Type NonConstType; \
- typedef WTF::IsSubclassOfTemplate<NonConstType, GarbageCollected> GarbageCollectedSubclass; \
- typedef IsGarbageCollectedMixin<NonConstType> GarbageCollectedMixinSubclass; \
- typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSetSubclass; \
- typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapLinkedHashSet> HeapLinkedHashSetSubclass; \
- typedef WTF::IsSubclassOfTemplateTypenameSizeTypename<NonConstType, HeapListHashSet> HeapListHashSetSubclass; \
- typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMapSubclass; \
- typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector> HeapVectorSubclass; \
- typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapDeque> HeapDequeSubclass; \
- typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashCountedSet> HeapHashCountedSetSubclass; \
- typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> HeapTerminatedArraySubclass; \
- COMPILE_ASSERT(GarbageCollectedSubclass::value || \
- GarbageCollectedMixinSubclass::value || \
- HeapHashSetSubclass::value || \
- HeapLinkedHashSetSubclass::value || \
- HeapListHashSetSubclass::value || \
- HeapHashMapSubclass::value || \
- HeapVectorSubclass::value || \
- HeapDequeSubclass::value || \
- HeapHashCountedSetSubclass::value || \
- HeapTerminatedArraySubclass::value, \
- ErrorMessage); \
- } while (0)
+template <typename T>
+struct IsGarbageCollectedType {
+ typedef typename WTF::RemoveConst<T>::Type NonConstType;
+ typedef WTF::IsSubclassOfTemplate<NonConstType, GarbageCollected> GarbageCollectedSubclass;
+ typedef IsGarbageCollectedMixin<NonConstType> GarbageCollectedMixinSubclass;
+ typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSetSubclass;
+ typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapLinkedHashSet> HeapLinkedHashSetSubclass;
+ typedef WTF::IsSubclassOfTemplateTypenameSizeTypename<NonConstType, HeapListHashSet> HeapListHashSetSubclass;
+ typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMapSubclass;
+ typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector> HeapVectorSubclass;
+ typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapDeque> HeapDequeSubclass;
+ typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashCountedSet> HeapHashCountedSetSubclass;
+ typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> HeapTerminatedArraySubclass;
+ static const bool value =
+ GarbageCollectedSubclass::value
+ || GarbageCollectedMixinSubclass::value
+ || HeapHashSetSubclass::value
+ || HeapLinkedHashSetSubclass::value
+ || HeapListHashSetSubclass::value
+ || HeapHashMapSubclass::value
+ || HeapVectorSubclass::value
+ || HeapDequeSubclass::value
+ || HeapHashCountedSetSubclass::value
+ || HeapTerminatedArraySubclass::value;
+};
+
+#define COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, ErrorMessage) \
+ COMPILE_ASSERT(IsGarbageCollectedType<T>::value, ErrorMessage)
template<typename T> class Member;
@@ -1160,31 +1163,28 @@ struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
// For wtf/Functional.h
template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits;
-template<typename T> struct PointerParamStorageTraits<T*, false> {
+template<typename T>
+struct PointerParamStorageTraits<T*, false> {
typedef T* StorageType;
static StorageType wrap(T* value) { return value; }
static T* unwrap(const StorageType& value) { return value; }
};
-template<typename T> struct PointerParamStorageTraits<T*, true> {
+template<typename T>
+struct PointerParamStorageTraits<T*, true> {
typedef WebCore::CrossThreadPersistent<T> StorageType;
static StorageType wrap(T* value) { return value; }
static T* unwrap(const StorageType& value) { return value.get(); }
};
-// FIXME: This doesn't support collections and const types. See
-// COMPILE_ASSERT_IS_GARBAGE_COLLECTED.
-template<typename T> struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WTF::IsSubclassOfTemplate<T, WebCore::GarbageCollected>::value || WebCore::IsGarbageCollectedMixin<T>::value> {
+template<typename T>
+struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WebCore::IsGarbageCollectedType<T>::value> {
};
-// We assume RawPtr<T> is used only for garbage-collected types.
-template<typename T> struct ParamStorageTraits<RawPtr<T> > {
- typedef WebCore::CrossThreadPersistent<T> StorageType;
-
- static StorageType wrap(RawPtr<T> value) { return value.get(); }
- static T* unwrap(const StorageType& value) { return value.get(); }
+template<typename T>
+struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, WebCore::IsGarbageCollectedType<T>::value> {
};
} // namespace WTF
« no previous file with comments | « no previous file | Source/platform/heap/HeapTest.cpp » ('j') | Source/platform/heap/HeapTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698