v8  8.6.395 (node 15.0.1)
V8 is Google's open source JavaScript engine
Visitor Class Reference

#include <visitor.h>

Inheritance diagram for Visitor:

Data Structures

class  Key
 

Public Member Functions

 Visitor (Key)
 
virtual ~Visitor ()=default
 
template<typename T >
void Trace (const Member< T > &member)
 
template<typename T >
void Trace (const WeakMember< T > &weak_member)
 
template<typename T >
void Trace (const T &object)
 
template<typename T , void(T::*)(const LivenessBroker &) method>
void RegisterWeakCallbackMethod (const T *object)
 
virtual void RegisterWeakCallback (WeakCallback callback, const void *data)
 

Protected Member Functions

virtual void Visit (const void *self, TraceDescriptor)
 
virtual void VisitWeak (const void *self, TraceDescriptor, WeakCallback, const void *weak_member)
 
virtual void VisitRoot (const void *, TraceDescriptor)
 
virtual void VisitWeakRoot (const void *self, TraceDescriptor, WeakCallback, const void *weak_root)
 

Friends

template<typename T , typename WeaknessPolicy , typename LocationPolicy , typename CheckingPolicy >
class internal::BasicPersistent
 
class internal::ConservativeTracingVisitor
 
class internal::VisitorBase
 

Detailed Description

Visitor passed to trace methods. All managed pointers must have called the Visitor's trace method on them.

class Foo final : public GarbageCollected<Foo> {
public:
void Trace(Visitor* visitor) const {
visitor->Trace(foo_);
visitor->Trace(weak_foo_);
}
private:
Member<Foo> foo_;
WeakMember<Foo> weak_foo_;
};
void Trace(const Member< T > &member)
Definition: visitor.h:65
Visitor(Key)
Definition: visitor.h:55

Definition at line 47 of file visitor.h.

Constructor & Destructor Documentation

◆ Visitor()

Visitor ( Key  )
inlineexplicit

Definition at line 55 of file visitor.h.

Referenced by JSVisitor::JSVisitor().

◆ ~Visitor()

virtual ~Visitor ( )
virtualdefault

Member Function Documentation

◆ RegisterWeakCallback()

virtual void RegisterWeakCallback ( WeakCallback  callback,
const void *  data 
)
inlinevirtual

Registers a weak callback that is invoked during garbage collection.

Parameters
callbackto be invoked.
datacustom data that is passed to the callback.

Definition at line 130 of file visitor.h.

Referenced by Visitor::RegisterWeakCallbackMethod().

◆ RegisterWeakCallbackMethod()

void RegisterWeakCallbackMethod ( const T *  object)
inline

Registers a weak callback method on the object of type T. See LivenessBroker for an usage example.

Parameters
objectof type T specifying a weak callback method.

Definition at line 120 of file visitor.h.

References Visitor::RegisterWeakCallback().

◆ Trace() [1/3]

void Trace ( const Member< T > &  member)
inline

Trace method for Member.

Parameters
memberMember reference retaining an object.

Definition at line 65 of file visitor.h.

References cppgc::kSentinelPointer.

◆ Trace() [2/3]

void Trace ( const T &  object)
inline

Trace method for inlined objects that are not allocated themselves but otherwise follow managed heap layout and have a Trace() method.

Parameters
objectreference of the inlined object.

Definition at line 102 of file visitor.h.

◆ Trace() [3/3]

void Trace ( const WeakMember< T > &  weak_member)
inline

Trace method for WeakMember.

Parameters
weak_memberWeakMember reference weakly retaining an object.

Definition at line 77 of file visitor.h.

References Visitor::VisitWeak().

◆ Visit()

virtual void Visit ( const void *  self,
TraceDescriptor   
)
inlineprotectedvirtual

Definition at line 133 of file visitor.h.

◆ VisitRoot()

virtual void VisitRoot ( const void *  ,
TraceDescriptor   
)
inlineprotectedvirtual

Definition at line 136 of file visitor.h.

◆ VisitWeak()

virtual void VisitWeak ( const void *  self,
TraceDescriptor  ,
WeakCallback  ,
const void *  weak_member 
)
inlineprotectedvirtual

Definition at line 134 of file visitor.h.

Referenced by Visitor::Trace().

◆ VisitWeakRoot()

virtual void VisitWeakRoot ( const void *  self,
TraceDescriptor  ,
WeakCallback  ,
const void *  weak_root 
)
inlineprotectedvirtual

Definition at line 137 of file visitor.h.

Friends And Related Function Documentation

◆ internal::BasicPersistent

◆ internal::ConservativeTracingVisitor

friend class internal::ConservativeTracingVisitor
friend

Definition at line 207 of file visitor.h.

◆ internal::VisitorBase

friend class internal::VisitorBase
friend

Definition at line 208 of file visitor.h.


The documentation for this class was generated from the following file: