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 26 matching lines...) Expand all Loading... |
37 #include "wtf/HashFunctions.h" | 37 #include "wtf/HashFunctions.h" |
38 #include "wtf/Locker.h" | 38 #include "wtf/Locker.h" |
39 #include "wtf/RawPtr.h" | 39 #include "wtf/RawPtr.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 #include "wtf/TypeTraits.h" | 41 #include "wtf/TypeTraits.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 template<typename T> class HeapTerminatedArray; | 45 template<typename T> class HeapTerminatedArray; |
46 | 46 |
47 #define COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, ErrorMessage)
\ | 47 #define COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, ErrorMessage)
\ |
48 typedef typename WTF::RemoveConst<T>::Type NonConstType;
\ | 48 do {
\ |
49 typedef WTF::IsSubclassOfTemplate<NonConstType, GarbageCollected> GarbageCol
lectedSubclass; \ | 49 typedef typename WTF::RemoveConst<T>::Type NonConstType;
\ |
50 typedef WTF::IsSubclass<NonConstType, GarbageCollectedMixin> GarbageCollecte
dMixinSubclass; \ | 50 typedef WTF::IsSubclassOfTemplate<NonConstType, GarbageCollected> Garbag
eCollectedSubclass; \ |
51 typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSetSub
class; \ | 51 typedef WTF::IsSubclass<NonConstType, GarbageCollectedMixin> GarbageColl
ectedMixinSubclass; \ |
52 typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMapSub
class; \ | 52 typedef WTF::IsSubclassOfTemplate3<NonConstType, HeapHashSet> HeapHashSe
tSubclass; \ |
53 typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector> Heap
VectorSubclass; \ | 53 typedef WTF::IsSubclassOfTemplate5<NonConstType, HeapHashMap> HeapHashMa
pSubclass; \ |
54 typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> HeapTer
minatedArraySubclass; \ | 54 typedef WTF::IsSubclassOfTemplateTypenameSize<NonConstType, HeapVector>
HeapVectorSubclass; \ |
55 COMPILE_ASSERT(GarbageCollectedSubclass::value ||
\ | 55 typedef WTF::IsSubclassOfTemplate<NonConstType, HeapTerminatedArray> Hea
pTerminatedArraySubclass; \ |
56 GarbageCollectedMixinSubclass::value ||
\ | 56 COMPILE_ASSERT(GarbageCollectedSubclass::value ||
\ |
57 HeapHashSetSubclass::value ||
\ | 57 GarbageCollectedMixinSubclass::value ||
\ |
58 HeapHashMapSubclass::value ||
\ | 58 HeapHashSetSubclass::value ||
\ |
59 HeapVectorSubclass::value ||
\ | 59 HeapHashMapSubclass::value ||
\ |
60 HeapTerminatedArraySubclass::value,
\ | 60 HeapVectorSubclass::value ||
\ |
61 ErrorMessage); | 61 HeapTerminatedArraySubclass::value,
\ |
| 62 ErrorMessage);
\ |
| 63 } while (0) |
62 | 64 |
63 template<typename T> class Member; | 65 template<typename T> class Member; |
64 | 66 |
65 class PersistentNode { | 67 class PersistentNode { |
66 public: | 68 public: |
67 explicit PersistentNode(TraceCallback trace) | 69 explicit PersistentNode(TraceCallback trace) |
68 : m_trace(trace) | 70 : m_trace(trace) |
69 { | 71 { |
70 } | 72 } |
71 | 73 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 Member(T* raw) : m_raw(raw) | 443 Member(T* raw) : m_raw(raw) |
442 { | 444 { |
443 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 445 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
444 } | 446 } |
445 | 447 |
446 explicit Member(T& raw) : m_raw(&raw) | 448 explicit Member(T& raw) : m_raw(&raw) |
447 { | 449 { |
448 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 450 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
449 } | 451 } |
450 | 452 |
| 453 template<typename U> |
| 454 Member(const RawPtr<U>& other) : m_raw(other.get()) |
| 455 { |
| 456 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
| 457 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(U, NonGarbageCollectedObjectInMember
); |
| 458 } |
| 459 |
451 Member(WTF::HashTableDeletedValueType) : m_raw(reinterpret_cast<T*>(-1)) | 460 Member(WTF::HashTableDeletedValueType) : m_raw(reinterpret_cast<T*>(-1)) |
452 { | 461 { |
453 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); | 462 COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInMember
); |
454 } | 463 } |
455 | 464 |
456 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } | 465 bool isHashTableDeletedValue() const { return m_raw == reinterpret_cast<T*>(
-1); } |
457 | 466 |
458 template<typename U> | 467 template<typename U> |
459 Member(const Persistent<U>& other) : m_raw(other) { } | 468 Member(const Persistent<U>& other) : m_raw(other) { } |
460 | 469 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 }; | 979 }; |
971 | 980 |
972 template<typename T, typename U> | 981 template<typename T, typename U> |
973 struct NeedsTracing<HashMap<T, U> > { | 982 struct NeedsTracing<HashMap<T, U> > { |
974 static const bool value = false; | 983 static const bool value = false; |
975 }; | 984 }; |
976 | 985 |
977 } // namespace WTF | 986 } // namespace WTF |
978 | 987 |
979 #endif | 988 #endif |
OLD | NEW |