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

Side by Side Diff: Source/platform/heap/Handle.h

Issue 614373007: Oilpan: Remove adoptRefCountedGarbageCollected (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 // aliases. So, slightly unfortunately, fall back/down to the lowest 1004 // aliases. So, slightly unfortunately, fall back/down to the lowest
1005 // commmon denominator of using CPP macros only. 1005 // commmon denominator of using CPP macros only.
1006 #if ENABLE(OILPAN) 1006 #if ENABLE(OILPAN)
1007 #define PassRefPtrWillBeRawPtr WTF::RawPtr 1007 #define PassRefPtrWillBeRawPtr WTF::RawPtr
1008 #define RefCountedWillBeGarbageCollected blink::GarbageCollected 1008 #define RefCountedWillBeGarbageCollected blink::GarbageCollected
1009 #define RefCountedWillBeGarbageCollectedFinalized blink::GarbageCollectedFinaliz ed 1009 #define RefCountedWillBeGarbageCollectedFinalized blink::GarbageCollectedFinaliz ed
1010 #define RefCountedWillBeRefCountedGarbageCollected blink::RefCountedGarbageColle cted 1010 #define RefCountedWillBeRefCountedGarbageCollected blink::RefCountedGarbageColle cted
1011 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::Garbage CollectedFinalized 1011 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::Garbage CollectedFinalized
1012 #define ThreadSafeRefCountedWillBeGarbageCollected blink::GarbageCollected 1012 #define ThreadSafeRefCountedWillBeGarbageCollected blink::GarbageCollected
1013 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized blink::GarbageCollec tedFinalized 1013 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized blink::GarbageCollec tedFinalized
1014 #define ThreadSafeRefCountedWillBeThreadSafeRefCountedGarbageCollected blink::Th readSafeRefCountedGarbageCollected
1015 #define PersistentWillBeMember blink::Member 1014 #define PersistentWillBeMember blink::Member
1016 #define CrossThreadPersistentWillBeMember blink::Member 1015 #define CrossThreadPersistentWillBeMember blink::Member
1017 #define RefPtrWillBePersistent blink::Persistent 1016 #define RefPtrWillBePersistent blink::Persistent
1018 #define RefPtrWillBeRawPtr WTF::RawPtr 1017 #define RefPtrWillBeRawPtr WTF::RawPtr
1019 #define RefPtrWillBeMember blink::Member 1018 #define RefPtrWillBeMember blink::Member
1020 #define RefPtrWillBeWeakMember blink::WeakMember 1019 #define RefPtrWillBeWeakMember blink::WeakMember
1021 #define RefPtrWillBeCrossThreadPersistent blink::CrossThreadPersistent 1020 #define RefPtrWillBeCrossThreadPersistent blink::CrossThreadPersistent
1022 #define RawPtrWillBeMember blink::Member 1021 #define RawPtrWillBeMember blink::Member
1023 #define RawPtrWillBePersistent blink::Persistent 1022 #define RawPtrWillBePersistent blink::Persistent
1024 #define RawPtrWillBeWeakMember blink::WeakMember 1023 #define RawPtrWillBeWeakMember blink::WeakMember
(...skipping 26 matching lines...) Expand all
1051 #define WillBeHeapSupplement blink::HeapSupplement 1050 #define WillBeHeapSupplement blink::HeapSupplement
1052 #define WillBeHeapSupplementable blink::HeapSupplementable 1051 #define WillBeHeapSupplementable blink::HeapSupplementable
1053 #define WillBeHeapTerminatedArray blink::HeapTerminatedArray 1052 #define WillBeHeapTerminatedArray blink::HeapTerminatedArray
1054 #define WillBeHeapTerminatedArrayBuilder blink::HeapTerminatedArrayBuilder 1053 #define WillBeHeapTerminatedArrayBuilder blink::HeapTerminatedArrayBuilder
1055 #define WillBeHeapLinkedStack blink::HeapLinkedStack 1054 #define WillBeHeapLinkedStack blink::HeapLinkedStack
1056 #define PersistentHeapHashMapWillBeHeapHashMap blink::HeapHashMap 1055 #define PersistentHeapHashMapWillBeHeapHashMap blink::HeapHashMap
1057 #define PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet 1056 #define PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet
1058 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque 1057 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque
1059 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector 1058 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector
1060 1059
1061 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) 1060 template<typename T> T* adoptRefWillBeNoop(T* ptr)
1062 { 1061 {
1063 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
1064 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; 1062 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
1065 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected);
1066 COMPILE_ASSERT(notRefCounted, youMustAdopt);
1067 return PassRefPtrWillBeRawPtr<T>(ptr);
1068 }
1069
1070 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeRefCountedGarbageCo llected(T* ptr)
1071 {
1072 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
1073 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop);
1074 return PassRefPtrWillBeRawPtr<T>(adoptRefCountedGarbageCollected(ptr));
1075 }
1076
1077 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeThreadSafeRefCounte dGarbageCollected(T* ptr)
1078 {
1079 static const bool isThreadSafeRefCountedGarbageCollected = WTF::IsSubclassOf Template<typename WTF::RemoveConst<T>::Type, ThreadSafeRefCountedGarbageCollecte d>::value;
1080 COMPILE_ASSERT(isThreadSafeRefCountedGarbageCollected, useAdoptRefWillBeNoop );
1081 return PassRefPtrWillBeRawPtr<T>(adoptRefCountedGarbageCollected(ptr));
1082 }
1083
1084 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr)
1085 {
1086 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
1087 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
1088 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected);
1089 COMPILE_ASSERT(notRefCounted, youMustAdopt);
1090 return PassOwnPtrWillBeRawPtr<T>(ptr);
1091 }
1092
1093 template<typename T> T* adoptPtrWillBeRefCountedGarbageCollected(T* ptr)
1094 {
1095 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
1096 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop);
1097 return adoptRefCountedGarbageCollected(ptr);
1098 }
1099
1100 template<typename T> T* adoptRefCountedGarbageCollectedWillBeNoop(T* ptr)
1101 {
1102 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
1103 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
1104 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected);
1105 COMPILE_ASSERT(notRefCounted, youMustAdopt); 1063 COMPILE_ASSERT(notRefCounted, youMustAdopt);
1106 return ptr; 1064 return ptr;
1107 } 1065 }
1066
1067 template<typename T> T* adoptPtrWillBeNoop(T* ptr)
1068 {
1069 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value;
1070 COMPILE_ASSERT(notRefCounted, youMustAdopt);
1071 return ptr;
1072 }
1108 1073
1109 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled. 1074 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled.
1110 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing 1075 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
1111 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing 1076 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
1112 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing 1077 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing
1113 1078
1114 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ 1079 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \
1115 static type* name = (new Persistent<type>(arguments))->get(); 1080 static type* name = (new Persistent<type>(arguments))->get();
1116 1081
1117 #else // !ENABLE(OILPAN) 1082 #else // !ENABLE(OILPAN)
1118 1083
1119 template<typename T> 1084 template<typename T>
1120 class DummyBase { 1085 class DummyBase {
1121 public: 1086 public:
1122 DummyBase() { } 1087 DummyBase() { }
1123 ~DummyBase() { } 1088 ~DummyBase() { }
1124 }; 1089 };
1125 1090
1126 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr 1091 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr
1127 #define RefCountedWillBeGarbageCollected WTF::RefCounted 1092 #define RefCountedWillBeGarbageCollected WTF::RefCounted
1128 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted 1093 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted
1129 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted 1094 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted
1130 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::RefCoun tedGarbageCollected 1095 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::RefCoun tedGarbageCollected
1131 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted 1096 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted
1132 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo unted 1097 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo unted
1133 #define ThreadSafeRefCountedWillBeThreadSafeRefCountedGarbageCollected WTF::Thre adSafeRefCounted
1134 #define PersistentWillBeMember blink::Persistent 1098 #define PersistentWillBeMember blink::Persistent
1135 #define CrossThreadPersistentWillBeMember blink::CrossThreadPersistent 1099 #define CrossThreadPersistentWillBeMember blink::CrossThreadPersistent
1136 #define RefPtrWillBePersistent WTF::RefPtr 1100 #define RefPtrWillBePersistent WTF::RefPtr
1137 #define RefPtrWillBeRawPtr WTF::RefPtr 1101 #define RefPtrWillBeRawPtr WTF::RefPtr
1138 #define RefPtrWillBeMember WTF::RefPtr 1102 #define RefPtrWillBeMember WTF::RefPtr
1139 #define RefPtrWillBeWeakMember WTF::RefPtr 1103 #define RefPtrWillBeWeakMember WTF::RefPtr
1140 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr 1104 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr
1141 #define RawPtrWillBeMember WTF::RawPtr 1105 #define RawPtrWillBeMember WTF::RawPtr
1142 #define RawPtrWillBePersistent WTF::RawPtr 1106 #define RawPtrWillBePersistent WTF::RawPtr
1143 #define RawPtrWillBeWeakMember WTF::RawPtr 1107 #define RawPtrWillBeWeakMember WTF::RawPtr
(...skipping 27 matching lines...) Expand all
1171 #define WillBeHeapSupplementable blink::Supplementable 1135 #define WillBeHeapSupplementable blink::Supplementable
1172 #define WillBeHeapTerminatedArray WTF::TerminatedArray 1136 #define WillBeHeapTerminatedArray WTF::TerminatedArray
1173 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder 1137 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder
1174 #define WillBeHeapLinkedStack WTF::LinkedStack 1138 #define WillBeHeapLinkedStack WTF::LinkedStack
1175 #define PersistentHeapHashMapWillBeHeapHashMap blink::PersistentHeapHashMap 1139 #define PersistentHeapHashMapWillBeHeapHashMap blink::PersistentHeapHashMap
1176 #define PersistentHeapHashSetWillBeHeapHashSet blink::PersistentHeapHashSet 1140 #define PersistentHeapHashSetWillBeHeapHashSet blink::PersistentHeapHashSet
1177 #define PersistentHeapDequeWillBeHeapDeque blink::PersistentHeapDeque 1141 #define PersistentHeapDequeWillBeHeapDeque blink::PersistentHeapDeque
1178 #define PersistentHeapVectorWillBeHeapVector blink::PersistentHeapVector 1142 #define PersistentHeapVectorWillBeHeapVector blink::PersistentHeapVector
1179 1143
1180 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) { retu rn adoptRef(ptr); } 1144 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) { retu rn adoptRef(ptr); }
1181 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeRefCountedGarbageCo llected(T* ptr) { return adoptRef(ptr); }
1182 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeThreadSafeRefCounte dGarbageCollected(T* ptr) { return adoptRef(ptr); }
1183 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr) { retu rn adoptPtr(ptr); } 1145 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr) { retu rn adoptPtr(ptr); }
1184 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeRefCountedGarbageCo llected(T* ptr) { return adoptPtr(ptr); }
1185
1186 template<typename T> T* adoptRefCountedGarbageCollectedWillBeNoop(T* ptr)
1187 {
1188 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value;
1189 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop);
1190 return adoptRefCountedGarbageCollected(ptr);
1191 }
1192
1193 1146
1194 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED 1147 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED
1195 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ 1148 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \
1196 public: \ 1149 public: \
1197 ~type(); \ 1150 ~type(); \
1198 private: 1151 private:
1199 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \ 1152 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \
1200 public: \ 1153 public: \
1201 virtual ~type(); \ 1154 virtual ~type(); \
1202 private: 1155 private:
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGa rbageCollectedType<T>::value> { 1349 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGa rbageCollectedType<T>::value> {
1397 }; 1350 };
1398 1351
1399 template<typename T> 1352 template<typename T>
1400 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, bli nk::IsGarbageCollectedType<T>::value> { 1353 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, bli nk::IsGarbageCollectedType<T>::value> {
1401 }; 1354 };
1402 1355
1403 } // namespace WTF 1356 } // namespace WTF
1404 1357
1405 #endif 1358 #endif
OLDNEW
« no previous file with comments | « Source/modules/websockets/WorkerThreadableWebSocketChannel.h ('k') | Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698