 |
V8
latest master commit
V8 is Google's open source JavaScript engine
|
Go to the documentation of this file.
5 #ifndef INCLUDE_CPPGC_VISITOR_H_
6 #define INCLUDE_CPPGC_VISITOR_H_
31 const T* value = member.GetRawAtomic();
38 static_assert(
sizeof(T),
"T must be fully defined");
40 "T must be GarabgeCollected or GarbageCollectedMixin type");
42 const T* value = weak_member.GetRawAtomic();
56 std::enable_if_t<Persistent::IsStrongPersistent::value>* =
nullptr>
59 static_assert(
sizeof(PointeeType),
60 "Persistent's pointee type must be fully defined");
62 "Persisent's pointee type must be GarabgeCollected or "
63 "GarbageCollectedMixin");
72 std::enable_if_t<!WeakPersistent::IsStrongPersistent::value>* =
nullptr>
75 static_assert(
sizeof(PointeeType),
76 "Persistent's pointee type must be fully defined");
78 "Persisent's pointee type must be GarabgeCollected or "
79 "GarbageCollectedMixin");
81 &HandleWeak<WeakPersistent>, &p);
84 template <
typename T,
void (T::*method)(const LivenessBroker&)>
94 const void* weak_member) {}
97 const void* weak_root) {}
100 template <
typename T,
void (T::*method)(const LivenessBroker&)>
101 static void WeakCallbackMethodDelegate(
const LivenessBroker& info,
105 (
const_cast<T*
>(
static_cast<const T*
>(
self))->*method)(info);
108 template <
typename Po
interType>
109 static void HandleWeak(
const LivenessBroker& info,
const void*
object) {
110 const PointerType* weak =
static_cast<const PointerType*
>(object);
111 const auto* raw = weak->Get();
112 if (raw && !info.IsHeapObjectAlive(raw)) {
116 const_cast<PointerType*
>(weak)->Clear();
122 template <
typename T>
123 void Trace(
const T* t) {
124 static_assert(
sizeof(T),
"T must be fully defined");
125 static_assert(internal::IsGarbageCollectedType<T>::value,
126 "T must be GarabgeCollected or GarbageCollectedMixin type");
138 #endif // INCLUDE_CPPGC_VISITOR_H_
virtual void VisitRoot(const void *, TraceDescriptor)
internal::BasicPersistent< T, internal::StrongPersistentPolicy > Persistent
virtual void VisitWeakRoot(const void *self, TraceDescriptor, WeakCallback, const void *weak_root)
static TraceDescriptor GetTraceDescriptor(const void *self)
internal::BasicPersistent< T, internal::WeakPersistentPolicy > WeakPersistent
virtual void RegisterWeakCallback(WeakCallback, const void *)
virtual void VisitWeak(const void *self, TraceDescriptor, WeakCallback, const void *weak_member)
void TraceRoot(const Persistent &p, const SourceLocation &loc)
friend class internal::VisitorBase
void TraceRoot(const WeakPersistent &p, const SourceLocation &loc)
virtual void Visit(const void *self, TraceDescriptor)
void(*)(const LivenessBroker &, const void *) WeakCallback
constexpr internal::SentinelPointer kSentinelPointer
#define CPPGC_DCHECK(condition)
void Trace(const Member< T > &member)
void RegisterWeakCallbackMethod(const T *obj)
void Trace(const WeakMember< T > &weak_member)