OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 #ifndef NDEBUG | 46 #ifndef NDEBUG |
47 #define DEBUG_ONLY(x) x | 47 #define DEBUG_ONLY(x) x |
48 #else | 48 #else |
49 #define DEBUG_ONLY(x) | 49 #define DEBUG_ONLY(x) |
50 #endif | 50 #endif |
51 | 51 |
52 namespace WebCore { | 52 namespace WebCore { |
53 | 53 |
54 class FinalizedHeapObjectHeader; | 54 class FinalizedHeapObjectHeader; |
| 55 template<typename T> class GarbageCollected; |
55 template<typename T> class GarbageCollectedFinalized; | 56 template<typename T> class GarbageCollectedFinalized; |
56 class HeapObjectHeader; | 57 class HeapObjectHeader; |
57 template<typename T> class Member; | 58 template<typename T> class Member; |
58 template<typename T> class WeakMember; | 59 template<typename T> class WeakMember; |
59 class Visitor; | 60 class Visitor; |
60 | 61 |
61 template<bool needsTracing, bool isWeak, bool markWeakMembersStrongly, typename
T, typename Traits> struct CollectionBackingTraceTrait; | 62 template<bool needsTracing, bool isWeak, bool markWeakMembersStrongly, typename
T, typename Traits> struct CollectionBackingTraceTrait; |
62 | 63 |
63 typedef void (*FinalizationCallback)(void*); | 64 typedef void (*FinalizationCallback)(void*); |
64 typedef void (*VisitorCallback)(Visitor*, void* self); | 65 typedef void (*VisitorCallback)(Visitor*, void* self); |
(...skipping 19 matching lines...) Expand all Loading... |
84 // reachable. There is a GCInfo struct for each class that directly | 85 // reachable. There is a GCInfo struct for each class that directly |
85 // inherits from GarbageCollected or GarbageCollectedFinalized. | 86 // inherits from GarbageCollected or GarbageCollectedFinalized. |
86 struct GCInfo { | 87 struct GCInfo { |
87 bool hasFinalizer() const { return m_nonTrivialFinalizer; } | 88 bool hasFinalizer() const { return m_nonTrivialFinalizer; } |
88 const char* m_typeMarker; | 89 const char* m_typeMarker; |
89 TraceCallback m_trace; | 90 TraceCallback m_trace; |
90 FinalizationCallback m_finalize; | 91 FinalizationCallback m_finalize; |
91 bool m_nonTrivialFinalizer; | 92 bool m_nonTrivialFinalizer; |
92 }; | 93 }; |
93 | 94 |
| 95 |
94 // Template struct to detect whether type T inherits from | 96 // Template struct to detect whether type T inherits from |
95 // GarbageCollectedFinalized. | 97 // GarbageCollectedFinalized. |
96 template<typename T> | 98 template<typename T> |
97 struct IsGarbageCollectedFinalized { | 99 struct IsGarbageCollectedFinalized { |
98 typedef char TrueType; | 100 typedef char TrueType; |
99 struct FalseType { | 101 struct FalseType { |
100 char dummy[2]; | 102 char dummy[2]; |
101 }; | 103 }; |
102 template<typename U> static TrueType has(GarbageCollectedFinalized<U>*); | 104 template<typename U> static TrueType has(GarbageCollectedFinalized<U>*); |
103 static FalseType has(...); | 105 static FalseType has(...); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 return visitor->isMarked(obj); | 543 return visitor->isMarked(obj); |
542 } | 544 } |
543 template<typename T> bool ObjectAliveTrait<Member<T> >::isAlive(Visitor* visitor
, const Member<T>& obj) | 545 template<typename T> bool ObjectAliveTrait<Member<T> >::isAlive(Visitor* visitor
, const Member<T>& obj) |
544 { | 546 { |
545 return visitor->isMarked(obj.get()); | 547 return visitor->isMarked(obj.get()); |
546 } | 548 } |
547 | 549 |
548 } | 550 } |
549 | 551 |
550 #endif | 552 #endif |
OLD | NEW |