Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
v8::EmbedderRootsHandler Class Referenceabstract

#include <v8-embedder-heap.h>

Public Types

enum class  RootHandling { kQueryEmbedderForNonDroppableReferences , kDontQueryEmbedderForAnyReference }
 

Public Member Functions

virtual ~EmbedderRootsHandler ()=default
 
 EmbedderRootsHandler ()=default
 
 EmbedderRootsHandler (RootHandling default_traced_reference_handling)
 
virtual bool IsRoot (const v8::TracedReference< v8::Value > &handle)=0
 
virtual void ResetRoot (const v8::TracedReference< v8::Value > &handle)=0
 
virtual bool TryResetRoot (const v8::TracedReference< v8::Value > &handle)
 

Friends

class internal::TracedHandles
 

Detailed Description

Handler for embedder roots on non-unified heap garbage collections.

Member Enumeration Documentation

◆ RootHandling

Enumerator
kQueryEmbedderForNonDroppableReferences 
kDontQueryEmbedderForAnyReference 

Constructor & Destructor Documentation

◆ ~EmbedderRootsHandler()

virtual v8::EmbedderRootsHandler::~EmbedderRootsHandler ( )
virtualdefault

◆ EmbedderRootsHandler() [1/2]

v8::EmbedderRootsHandler::EmbedderRootsHandler ( )
default

◆ EmbedderRootsHandler() [2/2]

v8::EmbedderRootsHandler::EmbedderRootsHandler ( RootHandling  default_traced_reference_handling)
inlineexplicit

Member Function Documentation

◆ IsRoot()

virtual bool v8::EmbedderRootsHandler::IsRoot ( const v8::TracedReference< v8::Value > &  handle)
pure virtual

Returns true if the |TracedReference| handle should be considered as root for the currently running non-tracing garbage collection and false otherwise. The default implementation will keep all |TracedReference| references as roots.

If this returns false, then V8 may decide that the object referred to by such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the |TracedReference|.

Note that the handle is different from the handle that the embedder holds for retaining the object.

The concrete implementations must be thread-safe.

◆ ResetRoot()

virtual void v8::EmbedderRootsHandler::ResetRoot ( const v8::TracedReference< v8::Value > &  handle)
pure virtual

Used in combination with |IsRoot|. Called by V8 when an object that is backed by a handle is reclaimed by a non-tracing garbage collection. It is up to the embedder to reset the original handle.

Note that the |handle| is different from the handle that the embedder holds for retaining the object. It is up to the embedder to find the original handle via the object or class id.

◆ TryResetRoot()

virtual bool v8::EmbedderRootsHandler::TryResetRoot ( const v8::TracedReference< v8::Value > &  handle)
inlinevirtual

Similar to |ResetRoot()|, but opportunistic. The function is called in parallel for different handles and as such must be thread-safe. In case, |false| is returned, |ResetRoot()| will be recalled for the same handle.

Friends And Related Function Documentation

◆ internal::TracedHandles

friend class internal::TracedHandles
friend

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