Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
cppgc::LivenessBroker Class Referencefinal

#include <liveness-broker.h>

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
 

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);
}
};
Definition: garbage-collected.h:53
Definition: liveness-broker.h:44
bool IsHeapObjectAlive(const T *object) const
Definition: liveness-broker.h:47
Definition: visitor.h:56
void RegisterWeakCallbackMethod(const T *object)
Definition: visitor.h:188
Definition: member.h:77

Member Function Documentation

◆ IsHeapObjectAlive() [1/3]

template<typename T >
bool cppgc::LivenessBroker::IsHeapObjectAlive ( const T *  object) const
inline
Here is the caller graph for this function:

◆ IsHeapObjectAlive() [2/3]

template<typename T >
bool cppgc::LivenessBroker::IsHeapObjectAlive ( const UntracedMember< T > &  untraced_member) const
inline
Here is the call graph for this function:

◆ IsHeapObjectAlive() [3/3]

template<typename T >
bool cppgc::LivenessBroker::IsHeapObjectAlive ( const WeakMember< T > &  weak_member) const
inline
Here is the call graph for this function:

Friends And Related Function Documentation

◆ internal::LivenessBrokerFactory

friend class internal::LivenessBrokerFactory
friend

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