v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
cppgc::LivenessBroker Class Referencefinal

#include <liveness-broker.h>

Collaboration diagram for cppgc::LivenessBroker:

Public Member Functions

template<typename T >
bool IsHeapObjectAlive (const T *object) const
 
template<typename T >
bool IsHeapObjectAlive (const WeakMember< T > &weak_member) const
 
template<typename T >
bool IsHeapObjectAlive (const UntracedMember< T > &untraced_member) const
 

Private Member Functions

 LivenessBroker ()=default
 
bool IsHeapObjectAliveImpl (const void *) const
 

Friends

class internal::LivenessBrokerFactory
 

Detailed Description

The broker is passed to weak callbacks to allow (temporarily) querying the liveness state of an object. References to non-live objects must be cleared when IsHeapObjectAlive() returns false.

class GCedWithCustomWeakCallback final
: public GarbageCollected<GCedWithCustomWeakCallback> {
public:
void CustomWeakCallbackMethod(const LivenessBroker& broker) {
if (!broker.IsHeapObjectAlive(bar))
bar = nullptr;
}
void Trace(cppgc::Visitor* visitor) const {
GCedWithCustomWeakCallback,
&GCedWithCustomWeakCallback::CustomWeakCallbackMethod>(this);
}
};
void RegisterWeakCallbackMethod(const T *object)
Definition visitor.h:207
JSHeapBroker * broker

Definition at line 44 of file liveness-broker.h.

Constructor & Destructor Documentation

◆ LivenessBroker()

cppgc::LivenessBroker::LivenessBroker ( )
privatedefault

Member Function Documentation

◆ IsHeapObjectAlive() [1/3]

template<typename T >
bool cppgc::LivenessBroker::IsHeapObjectAlive ( const T * object) const
inline

Definition at line 47 of file liveness-broker.h.

◆ IsHeapObjectAlive() [2/3]

template<typename T >
bool cppgc::LivenessBroker::IsHeapObjectAlive ( const UntracedMember< T > & untraced_member) const
inline

Definition at line 64 of file liveness-broker.h.

◆ IsHeapObjectAlive() [3/3]

template<typename T >
bool cppgc::LivenessBroker::IsHeapObjectAlive ( const WeakMember< T > & weak_member) const
inline

Definition at line 59 of file liveness-broker.h.

◆ IsHeapObjectAliveImpl()

bool cppgc::LivenessBroker::IsHeapObjectAliveImpl ( const void * payload) const
private

Definition at line 11 of file liveness-broker.cc.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ internal::LivenessBrokerFactory

friend class internal::LivenessBrokerFactory
friend

Definition at line 73 of file liveness-broker.h.


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