Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
dart::ApiZone Class Reference

#include <dart_api_state.h>

Public Member Functions

 ApiZone ()
 
 ~ApiZone ()
 
template<class ElementType >
ElementType * Alloc (intptr_t len)
 
template<class ElementType >
ElementType * Realloc (ElementType *old_array, intptr_t old_len, intptr_t new_len)
 
uword AllocUnsafe (intptr_t size)
 
intptr_t SizeInBytes () const
 
ZoneGetZone ()
 
void Reinit (Thread *thread)
 
void Reset (Thread *thread)
 

Friends

template<typename T >
class ApiGrowableArray
 

Detailed Description

Definition at line 30 of file dart_api_state.h.

Constructor & Destructor Documentation

◆ ApiZone()

dart::ApiZone::ApiZone ( )
inline

Definition at line 33 of file dart_api_state.h.

33 : zone_() {
34 Thread* thread = Thread::Current();
35 Zone* zone = thread != nullptr ? thread->zone() : nullptr;
36 zone_.Link(zone);
37 if (thread != nullptr) {
38 thread->set_zone(&zone_);
39 }
40 if (FLAG_trace_zones) {
41 OS::PrintErr("*** Starting a new Api zone 0x%" Px "(0x%" Px ")\n",
42 reinterpret_cast<intptr_t>(this),
43 reinterpret_cast<intptr_t>(&zone_));
44 }
45 }
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Thread * Current()
Definition thread.h:361
#define Px
Definition globals.h:410

◆ ~ApiZone()

dart::ApiZone::~ApiZone ( )
inline

Definition at line 48 of file dart_api_state.h.

48 {
49 Thread* thread = Thread::Current();
50#if defined(DEBUG)
51 if (thread == nullptr) {
52 ASSERT(zone_.handles()->CountScopedHandles() == 0);
53 ASSERT(zone_.handles()->CountZoneHandles() == 0);
54 }
55#endif
56 if ((thread != nullptr) && (thread->zone() == &zone_)) {
57 thread->set_zone(zone_.previous_);
58 }
59 if (FLAG_trace_zones) {
60 OS::PrintErr("*** Deleting Api zone 0x%" Px "(0x%" Px ")\n",
61 reinterpret_cast<intptr_t>(this),
62 reinterpret_cast<intptr_t>(&zone_));
63 }
64 }
int CountZoneHandles() const
int CountScopedHandles() const
VMHandles * handles()
Definition zone.h:73
#define ASSERT(E)

Member Function Documentation

◆ Alloc()

template<class ElementType >
ElementType * dart::ApiZone::Alloc ( intptr_t  len)
inline

Definition at line 70 of file dart_api_state.h.

70 {
71 return zone_.Alloc<ElementType>(len);
72 }
ElementType * Alloc(intptr_t length)

◆ AllocUnsafe()

uword dart::ApiZone::AllocUnsafe ( intptr_t  size)
inline

Definition at line 90 of file dart_api_state.h.

90{ return zone_.AllocUnsafe(size); }
void * AllocUnsafe(intptr_t size)

◆ GetZone()

Zone * dart::ApiZone::GetZone ( )
inline

Definition at line 96 of file dart_api_state.h.

96{ return &zone_; }

◆ Realloc()

template<class ElementType >
ElementType * dart::ApiZone::Realloc ( ElementType *  old_array,
intptr_t  old_len,
intptr_t  new_len 
)
inline

Definition at line 78 of file dart_api_state.h.

80 {
81 return zone_.Realloc<ElementType>(old_array, old_len, new_len);
82 }
ElementType * Realloc(ElementType *old_array, intptr_t old_length, intptr_t new_length)

◆ Reinit()

void dart::ApiZone::Reinit ( Thread thread)
inline

Definition at line 98 of file dart_api_state.h.

98 {
99 if (thread == nullptr) {
100 zone_.Link(nullptr);
101 } else {
102 zone_.Link(thread->zone());
103 thread->set_zone(&zone_);
104 }
105 }

◆ Reset()

void dart::ApiZone::Reset ( Thread thread)
inline

Definition at line 107 of file dart_api_state.h.

107 {
108 if ((thread != nullptr) && (thread->zone() == &zone_)) {
109 thread->set_zone(zone_.previous_);
110 }
111 zone_.Reset();
112 }

◆ SizeInBytes()

intptr_t dart::ApiZone::SizeInBytes ( ) const
inline

Definition at line 94 of file dart_api_state.h.

94{ return zone_.SizeInBytes(); }
uintptr_t SizeInBytes() const
Definition zone.cc:182

Friends And Related Symbol Documentation

◆ ApiGrowableArray

template<typename T >
friend class ApiGrowableArray
friend

Definition at line 118 of file dart_api_state.h.


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