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" | |
37 #include "wtf/HashFunctions.h" | 38 #include "wtf/HashFunctions.h" |
38 #include "wtf/Locker.h" | 39 #include "wtf/Locker.h" |
39 #include "wtf/RawPtr.h" | 40 #include "wtf/RawPtr.h" |
40 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
41 #include "wtf/TypeTraits.h" | 42 #include "wtf/TypeTraits.h" |
42 | 43 |
43 namespace WebCore { | 44 namespace WebCore { |
44 | 45 |
45 template<typename T> class HeapTerminatedArray; | 46 template<typename T> class HeapTerminatedArray; |
46 | 47 |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1145 }; | 1146 }; |
1146 | 1147 |
1147 template<typename T, size_t inlineCapacity> | 1148 template<typename T, size_t inlineCapacity> |
1148 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli neCapacity> > *> { | 1149 struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli neCapacity> > *> { |
1149 // All heap allocated node pointers need visiting to keep the nodes alive, | 1150 // All heap allocated node pointers need visiting to keep the nodes alive, |
1150 // regardless of whether they contain pointers to other heap allocated | 1151 // regardless of whether they contain pointers to other heap allocated |
1151 // objects. | 1152 // objects. |
1152 static const bool value = true; | 1153 static const bool value = true; |
1153 }; | 1154 }; |
1154 | 1155 |
1156 // For wtf/Functional.h | |
1157 template<typename T, bool isGC> struct PointerParamStorageTraits; | |
haraken
2014/06/06 05:54:53
Nit: isGC => isGarbageCollected
tkent
2014/06/06 06:52:48
Done.
| |
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 | |
1155 } // namespace WTF | 1186 } // namespace WTF |
1156 | 1187 |
1157 #endif | 1188 #endif |
OLD | NEW |