Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
cppgc::subtle::DisallowGarbageCollectionScope Class Referencefinal

#include <heap-consistency.h>

Public Member Functions

 DisallowGarbageCollectionScope (HeapHandle &heap_handle)
 
 ~DisallowGarbageCollectionScope ()
 
 DisallowGarbageCollectionScope (const DisallowGarbageCollectionScope &)=delete
 
DisallowGarbageCollectionScopeoperator= (const DisallowGarbageCollectionScope &)=delete
 

Static Public Member Functions

static bool IsGarbageCollectionAllowed (HeapHandle &heap_handle)
 
static void Enter (HeapHandle &heap_handle)
 
static void Leave (HeapHandle &heap_handle)
 

Detailed Description

Disallows garbage collection finalizations. Any garbage collection triggers result in a crash when in this scope.

Note that the garbage collector already covers paths that can lead to garbage collections, so user code does not require checking IsGarbageCollectionAllowed() before allocations.

Constructor & Destructor Documentation

◆ DisallowGarbageCollectionScope() [1/2]

cppgc::subtle::DisallowGarbageCollectionScope::DisallowGarbageCollectionScope ( HeapHandle heap_handle)
explicit

Constructs a scoped object that automatically enters and leaves a disallow garbage collection scope based on its lifetime.

Parameters
heap_handleThe corresponding heap.

◆ ~DisallowGarbageCollectionScope()

cppgc::subtle::DisallowGarbageCollectionScope::~DisallowGarbageCollectionScope ( )

◆ DisallowGarbageCollectionScope() [2/2]

cppgc::subtle::DisallowGarbageCollectionScope::DisallowGarbageCollectionScope ( const DisallowGarbageCollectionScope )
delete

Member Function Documentation

◆ Enter()

static void cppgc::subtle::DisallowGarbageCollectionScope::Enter ( HeapHandle heap_handle)
static

Enters a disallow garbage collection scope. Must be paired with Leave(). Prefer a scope instance of DisallowGarbageCollectionScope.

Parameters
heap_handleThe corresponding heap.

◆ IsGarbageCollectionAllowed()

static bool cppgc::subtle::DisallowGarbageCollectionScope::IsGarbageCollectionAllowed ( HeapHandle heap_handle)
static
Returns
whether garbage collections are currently allowed.

◆ Leave()

static void cppgc::subtle::DisallowGarbageCollectionScope::Leave ( HeapHandle heap_handle)
static

Leaves a disallow garbage collection scope. Must be paired with Enter(). Prefer a scope instance of DisallowGarbageCollectionScope.

Parameters
heap_handleThe corresponding heap.

◆ operator=()

DisallowGarbageCollectionScope & cppgc::subtle::DisallowGarbageCollectionScope::operator= ( const DisallowGarbageCollectionScope )
delete

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