Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 25 matching lines...) Expand all Loading... | |
| 1050 #define WillBeGarbageCollectedMixin blink::GarbageCollectedMixin | 1049 #define WillBeGarbageCollectedMixin blink::GarbageCollectedMixin |
| 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 PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet | 1055 #define PersistentHeapHashSetWillBeHeapHashSet blink::HeapHashSet |
| 1057 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque | 1056 #define PersistentHeapDequeWillBeHeapDeque blink::HeapDeque |
| 1058 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector | 1057 #define PersistentHeapVectorWillBeHeapVector blink::HeapVector |
| 1059 | 1058 |
| 1060 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) | 1059 template<typename T> RawPtr<T> adoptRefWillBeNoop(T* ptr) |
|
tkent
2014/10/02 07:59:36
RawPtr<T> -> T* ?
| |
| 1061 { | 1060 { |
| 1062 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
| 1063 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; | 1061 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; |
| 1064 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected); | |
| 1065 COMPILE_ASSERT(notRefCounted, youMustAdopt); | 1062 COMPILE_ASSERT(notRefCounted, youMustAdopt); |
| 1066 return PassRefPtrWillBeRawPtr<T>(ptr); | 1063 return RawPtr<T>(ptr); |
|
tkent
2014/10/02 07:59:36
RawPTR<T>(ptr) -> ptr?
| |
| 1067 } | 1064 } |
| 1068 | 1065 |
| 1069 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeRefCountedGarbageCo llected(T* ptr) | 1066 template<typename T> RawPtr<T> adoptPtrWillBeNoop(T* ptr) |
|
tkent
2014/10/02 07:59:36
Ditto.
| |
| 1070 { | 1067 { |
| 1071 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
| 1072 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop); | |
| 1073 return PassRefPtrWillBeRawPtr<T>(adoptRefCountedGarbageCollected(ptr)); | |
| 1074 } | |
| 1075 | |
| 1076 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeThreadSafeRefCounte dGarbageCollected(T* ptr) | |
| 1077 { | |
| 1078 static const bool isThreadSafeRefCountedGarbageCollected = WTF::IsSubclassOf Template<typename WTF::RemoveConst<T>::Type, ThreadSafeRefCountedGarbageCollecte d>::value; | |
| 1079 COMPILE_ASSERT(isThreadSafeRefCountedGarbageCollected, useAdoptRefWillBeNoop ); | |
| 1080 return PassRefPtrWillBeRawPtr<T>(adoptRefCountedGarbageCollected(ptr)); | |
| 1081 } | |
| 1082 | |
| 1083 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr) | |
| 1084 { | |
| 1085 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
| 1086 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; | 1068 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; |
| 1087 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected); | |
| 1088 COMPILE_ASSERT(notRefCounted, youMustAdopt); | 1069 COMPILE_ASSERT(notRefCounted, youMustAdopt); |
| 1089 return PassOwnPtrWillBeRawPtr<T>(ptr); | 1070 return RawPtr<T>(ptr); |
|
tkent
2014/10/02 07:59:36
Ditto.
| |
| 1090 } | |
| 1091 | |
| 1092 template<typename T> T* adoptPtrWillBeRefCountedGarbageCollected(T* ptr) | |
| 1093 { | |
| 1094 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
| 1095 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop); | |
| 1096 return adoptRefCountedGarbageCollected(ptr); | |
| 1097 } | |
| 1098 | |
| 1099 template<typename T> T* adoptRefCountedGarbageCollectedWillBeNoop(T* ptr) | |
| 1100 { | |
| 1101 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate <typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
| 1102 static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename WTF::R emoveConst<T>::Type, RefCounted>::value; | |
| 1103 COMPILE_ASSERT(notRefCountedGarbageCollected, useAdoptRefCountedWillBeRefCou ntedGarbageCollected); | |
| 1104 COMPILE_ASSERT(notRefCounted, youMustAdopt); | |
| 1105 return ptr; | |
| 1106 } | 1071 } |
| 1107 | 1072 |
| 1108 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled. | 1073 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED // do nothing when oilpan is ena bled. |
| 1109 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing | 1074 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing |
| 1110 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing | 1075 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing |
| 1111 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing | 1076 #define DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) // do nothing |
| 1112 | 1077 |
| 1113 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ | 1078 #define DEFINE_STATIC_REF_WILL_BE_PERSISTENT(type, name, arguments) \ |
| 1114 static type* name = (new Persistent<type>(arguments))->get(); | 1079 static type* name = (new Persistent<type>(arguments))->get(); |
| 1115 | 1080 |
| 1116 #else // !ENABLE(OILPAN) | 1081 #else // !ENABLE(OILPAN) |
| 1117 | 1082 |
| 1118 template<typename T> | 1083 template<typename T> |
| 1119 class DummyBase { | 1084 class DummyBase { |
| 1120 public: | 1085 public: |
| 1121 DummyBase() { } | 1086 DummyBase() { } |
| 1122 ~DummyBase() { } | 1087 ~DummyBase() { } |
| 1123 }; | 1088 }; |
| 1124 | 1089 |
| 1125 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr | 1090 #define PassRefPtrWillBeRawPtr WTF::PassRefPtr |
| 1126 #define RefCountedWillBeGarbageCollected WTF::RefCounted | 1091 #define RefCountedWillBeGarbageCollected WTF::RefCounted |
| 1127 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted | 1092 #define RefCountedWillBeGarbageCollectedFinalized WTF::RefCounted |
| 1128 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted | 1093 #define RefCountedWillBeRefCountedGarbageCollected WTF::RefCounted |
| 1129 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::RefCoun tedGarbageCollected | 1094 #define RefCountedGarbageCollectedWillBeGarbageCollectedFinalized blink::RefCoun tedGarbageCollected |
| 1130 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted | 1095 #define ThreadSafeRefCountedWillBeGarbageCollected WTF::ThreadSafeRefCounted |
| 1131 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo unted | 1096 #define ThreadSafeRefCountedWillBeGarbageCollectedFinalized WTF::ThreadSafeRefCo unted |
| 1132 #define ThreadSafeRefCountedWillBeThreadSafeRefCountedGarbageCollected WTF::Thre adSafeRefCounted | |
| 1133 #define PersistentWillBeMember blink::Persistent | 1097 #define PersistentWillBeMember blink::Persistent |
| 1134 #define CrossThreadPersistentWillBeMember blink::CrossThreadPersistent | 1098 #define CrossThreadPersistentWillBeMember blink::CrossThreadPersistent |
| 1135 #define RefPtrWillBePersistent WTF::RefPtr | 1099 #define RefPtrWillBePersistent WTF::RefPtr |
| 1136 #define RefPtrWillBeRawPtr WTF::RefPtr | 1100 #define RefPtrWillBeRawPtr WTF::RefPtr |
| 1137 #define RefPtrWillBeMember WTF::RefPtr | 1101 #define RefPtrWillBeMember WTF::RefPtr |
| 1138 #define RefPtrWillBeWeakMember WTF::RefPtr | 1102 #define RefPtrWillBeWeakMember WTF::RefPtr |
| 1139 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr | 1103 #define RefPtrWillBeCrossThreadPersistent WTF::RefPtr |
| 1140 #define RawPtrWillBeMember WTF::RawPtr | 1104 #define RawPtrWillBeMember WTF::RawPtr |
| 1141 #define RawPtrWillBePersistent WTF::RawPtr | 1105 #define RawPtrWillBePersistent WTF::RawPtr |
| 1142 #define RawPtrWillBeWeakMember WTF::RawPtr | 1106 #define RawPtrWillBeWeakMember WTF::RawPtr |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1169 #define WillBeHeapSupplement blink::Supplement | 1133 #define WillBeHeapSupplement blink::Supplement |
| 1170 #define WillBeHeapSupplementable blink::Supplementable | 1134 #define WillBeHeapSupplementable blink::Supplementable |
| 1171 #define WillBeHeapTerminatedArray WTF::TerminatedArray | 1135 #define WillBeHeapTerminatedArray WTF::TerminatedArray |
| 1172 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder | 1136 #define WillBeHeapTerminatedArrayBuilder WTF::TerminatedArrayBuilder |
| 1173 #define WillBeHeapLinkedStack WTF::LinkedStack | 1137 #define WillBeHeapLinkedStack WTF::LinkedStack |
| 1174 #define PersistentHeapHashSetWillBeHeapHashSet blink::PersistentHeapHashSet | 1138 #define PersistentHeapHashSetWillBeHeapHashSet blink::PersistentHeapHashSet |
| 1175 #define PersistentHeapDequeWillBeHeapDeque blink::PersistentHeapDeque | 1139 #define PersistentHeapDequeWillBeHeapDeque blink::PersistentHeapDeque |
| 1176 #define PersistentHeapVectorWillBeHeapVector blink::PersistentHeapVector | 1140 #define PersistentHeapVectorWillBeHeapVector blink::PersistentHeapVector |
| 1177 | 1141 |
| 1178 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) { retu rn adoptRef(ptr); } | 1142 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeNoop(T* ptr) { retu rn adoptRef(ptr); } |
| 1179 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeRefCountedGarbageCo llected(T* ptr) { return adoptRef(ptr); } | |
| 1180 template<typename T> PassRefPtrWillBeRawPtr<T> adoptRefWillBeThreadSafeRefCounte dGarbageCollected(T* ptr) { return adoptRef(ptr); } | |
| 1181 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr) { retu rn adoptPtr(ptr); } | 1143 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeNoop(T* ptr) { retu rn adoptPtr(ptr); } |
| 1182 template<typename T> PassOwnPtrWillBeRawPtr<T> adoptPtrWillBeRefCountedGarbageCo llected(T* ptr) { return adoptPtr(ptr); } | |
| 1183 | |
| 1184 template<typename T> T* adoptRefCountedGarbageCollectedWillBeNoop(T* ptr) | |
| 1185 { | |
| 1186 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<t ypename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
| 1187 COMPILE_ASSERT(isRefCountedGarbageCollected, useAdoptRefWillBeNoop); | |
| 1188 return adoptRefCountedGarbageCollected(ptr); | |
| 1189 } | |
| 1190 | |
| 1191 | 1144 |
| 1192 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED | 1145 #define WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED WTF_MAKE_FAST_ALLOCATED |
| 1193 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 1146 #define DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 1194 public: \ | 1147 public: \ |
| 1195 ~type(); \ | 1148 ~type(); \ |
| 1196 private: | 1149 private: |
| 1197 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \ | 1150 #define DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(type) \ |
| 1198 public: \ | 1151 public: \ |
| 1199 virtual ~type(); \ | 1152 virtual ~type(); \ |
| 1200 private: | 1153 private: |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1394 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGa rbageCollectedType<T>::value> { | 1347 struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGa rbageCollectedType<T>::value> { |
| 1395 }; | 1348 }; |
| 1396 | 1349 |
| 1397 template<typename T> | 1350 template<typename T> |
| 1398 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, bli nk::IsGarbageCollectedType<T>::value> { | 1351 struct ParamStorageTraits<RawPtr<T> > : public PointerParamStorageTraits<T*, bli nk::IsGarbageCollectedType<T>::value> { |
| 1399 }; | 1352 }; |
| 1400 | 1353 |
| 1401 } // namespace WTF | 1354 } // namespace WTF |
| 1402 | 1355 |
| 1403 #endif | 1356 #endif |
| OLD | NEW |