Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::PersistentHandles Class Reference

#include <dart_api_state.h>

Inheritance diagram for dart::PersistentHandles:
dart::Handles< kPersistentHandleSizeInWords, kPersistentHandlesPerChunk, kOffsetOfRawPtrInPersistentHandle >

Public Member Functions

 PersistentHandles ()
 
 ~PersistentHandles ()
 
PersistentHandlefree_list () const
 
void set_free_list (PersistentHandle *value)
 
void VisitObjectPointers (ObjectPointerVisitor *visitor)
 
void Visit (HandleVisitor *visitor)
 
PersistentHandleAllocateHandle ()
 
void FreeHandle (PersistentHandle *handle)
 
bool IsValidHandle (Dart_PersistentHandle object) const
 
bool IsFreeHandle (Dart_PersistentHandle object) const
 
int CountHandles () const
 

Detailed Description

Definition at line 427 of file dart_api_state.h.

Constructor & Destructor Documentation

◆ PersistentHandles()

dart::PersistentHandles::PersistentHandles ( )
inline

Definition at line 431 of file dart_api_state.h.

435 free_list_(nullptr) {
436 if (FLAG_trace_handles) {
437 OS::PrintErr("*** Starting a new Persistent handle block 0x%" Px "\n",
438 reinterpret_cast<intptr_t>(this));
439 }
440 }
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static constexpr int kPersistentHandlesPerChunk
static constexpr int kPersistentHandleSizeInWords
static constexpr int kOffsetOfRawPtrInPersistentHandle
#define Px
Definition: globals.h:410

◆ ~PersistentHandles()

dart::PersistentHandles::~PersistentHandles ( )
inline

Definition at line 441 of file dart_api_state.h.

441 {
442 free_list_ = nullptr;
443 if (FLAG_trace_handles) {
444 OS::PrintErr("*** Handle Counts for 0x(%" Px "):Scoped = %d\n",
445 reinterpret_cast<intptr_t>(this), CountHandles());
446 OS::PrintErr("*** Deleting Persistent handle block 0x%" Px "\n",
447 reinterpret_cast<intptr_t>(this));
448 }
449 }

Member Function Documentation

◆ AllocateHandle()

PersistentHandle * dart::PersistentHandles::AllocateHandle ( )
inline

Definition at line 471 of file dart_api_state.h.

471 {
472 PersistentHandle* handle;
473 if (free_list_ != nullptr) {
474 handle = free_list_;
475 free_list_ = handle->Next();
476 } else {
477 handle = reinterpret_cast<PersistentHandle*>(AllocateScopedHandle());
478 }
479 handle->set_ptr(Object::null());
480 return handle;
481 }
static ObjectPtr null()
Definition: object.h:433
void set_ptr(ObjectPtr ref)

◆ CountHandles()

int dart::PersistentHandles::CountHandles ( ) const
inline

◆ free_list()

PersistentHandle * dart::PersistentHandles::free_list ( ) const
inline

Definition at line 452 of file dart_api_state.h.

452{ return free_list_; }

◆ FreeHandle()

void dart::PersistentHandles::FreeHandle ( PersistentHandle handle)
inline

Definition at line 483 of file dart_api_state.h.

483 {
484 handle->FreeHandle(free_list());
485 set_free_list(handle);
486 }
PersistentHandle * free_list() const
void set_free_list(PersistentHandle *value)

◆ IsFreeHandle()

bool dart::PersistentHandles::IsFreeHandle ( Dart_PersistentHandle  object) const
inline

Definition at line 493 of file dart_api_state.h.

493 {
494 PersistentHandle* handle = free_list_;
495 while (handle != nullptr) {
496 if (handle == reinterpret_cast<PersistentHandle*>(object)) {
497 return true;
498 }
499 handle = handle->Next();
500 }
501 return false;
502 }

◆ IsValidHandle()

bool dart::PersistentHandles::IsValidHandle ( Dart_PersistentHandle  object) const
inline

Definition at line 489 of file dart_api_state.h.

489 {
490 return IsValidScopedHandle(reinterpret_cast<uword>(object));
491 }
uintptr_t uword
Definition: globals.h:501

◆ set_free_list()

void dart::PersistentHandles::set_free_list ( PersistentHandle value)
inline

Definition at line 453 of file dart_api_state.h.

453{ free_list_ = value; }
uint8_t value

◆ Visit()

void dart::PersistentHandles::Visit ( HandleVisitor visitor)
inline

Definition at line 464 of file dart_api_state.h.

◆ VisitObjectPointers()

void dart::PersistentHandles::VisitObjectPointers ( ObjectPointerVisitor visitor)
inline

Definition at line 456 of file dart_api_state.h.

456 {
457 visitor->set_gc_root_type("persistent handle");
460 visitor->clear_gc_root_type();
461 }
void VisitObjectPointers(ObjectPointerVisitor *visitor)

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