| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Handle_h | 31 #ifndef Handle_h |
| 32 #define Handle_h | 32 #define Handle_h |
| 33 | 33 |
| 34 #include "platform/heap/Heap.h" | 34 #include "platform/heap/Heap.h" |
| 35 #include "platform/heap/ThreadState.h" | 35 #include "platform/heap/ThreadState.h" |
| 36 #include "platform/heap/Visitor.h" | 36 #include "platform/heap/Visitor.h" |
| 37 #include "wtf/Functional.h" | |
| 38 #include "wtf/HashFunctions.h" | 37 #include "wtf/HashFunctions.h" |
| 39 #include "wtf/Locker.h" | 38 #include "wtf/Locker.h" |
| 40 #include "wtf/RawPtr.h" | 39 #include "wtf/RawPtr.h" |
| 41 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
| 42 #include "wtf/TypeTraits.h" | 41 #include "wtf/TypeTraits.h" |
| 43 | 42 |
| 44 namespace WebCore { | 43 namespace WebCore { |
| 45 | 44 |
| 46 template<typename T> class HeapTerminatedArray; | 45 template<typename T> class HeapTerminatedArray; |
| 47 | 46 |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 }; | 1145 }; |
| 1147 | 1146 |
| 1148 template<typename T, size_t inlineCapacity> | 1147 template<typename T, size_t inlineCapacity> |
| 1149 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
neCapacity> > *> { | 1148 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
neCapacity> > *> { |
| 1150 // All heap allocated node pointers need visiting to keep the nodes alive, | 1149 // All heap allocated node pointers need visiting to keep the nodes alive, |
| 1151 // regardless of whether they contain pointers to other heap allocated | 1150 // regardless of whether they contain pointers to other heap allocated |
| 1152 // objects. | 1151 // objects. |
| 1153 static const bool value = true; | 1152 static const bool value = true; |
| 1154 }; | 1153 }; |
| 1155 | 1154 |
| 1156 // For wtf/Functional.h | |
| 1157 template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits; | |
| 1158 | |
| 1159 template<typename T> struct PointerParamStorageTraits<T*, false> { | |
| 1160 typedef T* StorageType; | |
| 1161 | |
| 1162 static StorageType wrap(T* value) { return value; } | |
| 1163 static T* unwrap(const StorageType& value) { return value; } | |
| 1164 }; | |
| 1165 | |
| 1166 template<typename T> struct PointerParamStorageTraits<T*, true> { | |
| 1167 typedef WebCore::CrossThreadPersistent<T> StorageType; | |
| 1168 | |
| 1169 static StorageType wrap(T* value) { return value; } | |
| 1170 static T* unwrap(const StorageType& value) { return value.get(); } | |
| 1171 }; | |
| 1172 | |
| 1173 // FIXME: This doesn't support collections and const types. See | |
| 1174 // COMPILE_ASSERT_IS_GARBAGE_COLLECTED. | |
| 1175 template<typename T> struct ParamStorageTraits<T*> : public PointerParamStorageT
raits<T*, WTF::IsSubclassOfTemplate<T, WebCore::GarbageCollected>::value || WebC
ore::IsGarbageCollectedMixin<T>::value> { | |
| 1176 }; | |
| 1177 | |
| 1178 // We assume RawPtr<T> is used only for garbage-collected types. | |
| 1179 template<typename T> struct ParamStorageTraits<RawPtr<T> > { | |
| 1180 typedef WebCore::CrossThreadPersistent<T> StorageType; | |
| 1181 | |
| 1182 static StorageType wrap(RawPtr<T> value) { return value.get(); } | |
| 1183 static T* unwrap(const StorageType& value) { return value.get(); } | |
| 1184 }; | |
| 1185 | |
| 1186 } // namespace WTF | 1155 } // namespace WTF |
| 1187 | 1156 |
| 1188 #endif | 1157 #endif |
| OLD | NEW |