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

#include <class_table.h>

Inheritance diagram for dart::ClassTableAllocator:
dart::ValueObject

Public Member Functions

 ClassTableAllocator ()
 
 ~ClassTableAllocator ()
 
template<class T >
TAlloc (intptr_t len)
 
template<class T >
TAllocZeroInitialized (intptr_t len)
 
template<class T >
TClone (T *array, intptr_t size)
 
template<class T >
TRealloc (T *array, intptr_t size, intptr_t new_size)
 
void Free (ClassTable *table)
 
void Free (void *ptr)
 
void FreePending ()
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 84 of file class_table.h.

Constructor & Destructor Documentation

◆ ClassTableAllocator()

dart::ClassTableAllocator::ClassTableAllocator ( )

Definition at line 387 of file class_table.cc.

388 : pending_freed_(new MallocGrowableArray<std::pair<void*, Deleter>>()) {}

◆ ~ClassTableAllocator()

dart::ClassTableAllocator::~ClassTableAllocator ( )

Definition at line 390 of file class_table.cc.

390 {
391 FreePending();
392 delete pending_freed_;
393}

Member Function Documentation

◆ Alloc()

template<class T >
T * dart::ClassTableAllocator::Alloc ( intptr_t  len)
inline

Definition at line 93 of file class_table.h.

93 {
94 return reinterpret_cast<T*>(dart::malloc(len * sizeof(T)));
95 }
void * malloc(size_t size)
Definition: allocation.cc:19
#define T
Definition: precompiler.cc:65

◆ AllocZeroInitialized()

template<class T >
T * dart::ClassTableAllocator::AllocZeroInitialized ( intptr_t  len)
inline

Definition at line 99 of file class_table.h.

99 {
100 return reinterpret_cast<T*>(dart::calloc(len, sizeof(T)));
101 }
void * calloc(size_t n, size_t size)
Definition: allocation.cc:11

◆ Clone()

template<class T >
T * dart::ClassTableAllocator::Clone ( T array,
intptr_t  size 
)
inline

Definition at line 105 of file class_table.h.

105 {
106 if (array == nullptr) {
107 ASSERT(size == 0);
108 return nullptr;
109 }
110 auto result = Alloc<T>(size);
111 memmove(result, array, size * sizeof(T));
112 return result;
113 }
#define ASSERT(E)
GAsyncResult * result
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ Free() [1/2]

void dart::ClassTableAllocator::Free ( ClassTable table)

Definition at line 395 of file class_table.cc.

395 {
396 if (ptr != nullptr) {
397 pending_freed_->Add(std::make_pair(
398 ptr, [](void* ptr) { delete static_cast<ClassTable*>(ptr); }));
399 }
400}
void Add(const T &value)

◆ Free() [2/2]

void dart::ClassTableAllocator::Free ( void *  ptr)

Definition at line 402 of file class_table.cc.

402 {
403 if (ptr != nullptr) {
404 pending_freed_->Add(std::make_pair(ptr, nullptr));
405 }
406}

◆ FreePending()

void dart::ClassTableAllocator::FreePending ( )

Definition at line 408 of file class_table.cc.

408 {
409 while (!pending_freed_->is_empty()) {
410 auto [ptr, deleter] = pending_freed_->RemoveLast();
411 if (deleter == nullptr) {
412 free(ptr);
413 } else {
414 deleter(ptr);
415 }
416 }
417}

◆ Realloc()

template<class T >
T * dart::ClassTableAllocator::Realloc ( T array,
intptr_t  size,
intptr_t  new_size 
)
inline

Definition at line 121 of file class_table.h.

121 {
122 ASSERT(size < new_size);
123 auto result = AllocZeroInitialized<T>(new_size);
124 if (size != 0) {
125 ASSERT(result != nullptr);
126 memmove(result, array, size * sizeof(T));
127 }
128 Free(array);
129 return result;
130 }
void Free(ClassTable *table)
Definition: class_table.cc:395

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