Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::FinalizablePersistentHandle Class Reference

#include <dart_api_state.h>

Public Member Functions

ObjectPtr ptr () const
 
ObjectPtrptr_addr ()
 
void * peer () const
 
Dart_HandleFinalizer callback () const
 
Dart_WeakPersistentHandle ApiWeakPersistentHandle ()
 
Dart_FinalizableHandle ApiFinalizableHandle ()
 
bool auto_delete () const
 
bool IsFinalizedNotFreed () const
 
intptr_t external_size () const
 
bool SetExternalSize (intptr_t size, IsolateGroup *isolate_group)
 
void UpdateUnreachable (IsolateGroup *isolate_group)
 
void UpdateRelocated (IsolateGroup *isolate_group)
 
void EnsureFreedExternal (IsolateGroup *isolate_group)
 

Static Public Member Functions

static FinalizablePersistentHandleNew (IsolateGroup *isolate_group, const Object &object, void *peer, Dart_HandleFinalizer callback, intptr_t external_size, bool auto_delete)
 
static intptr_t ptr_offset ()
 
static FinalizablePersistentHandleCast (Dart_WeakPersistentHandle handle)
 
static FinalizablePersistentHandleCast (Dart_FinalizableHandle handle)
 

Friends

class FinalizablePersistentHandles
 

Detailed Description

Definition at line 190 of file dart_api_state.h.

Member Function Documentation

◆ ApiFinalizableHandle()

Dart_FinalizableHandle dart::FinalizablePersistentHandle::ApiFinalizableHandle ( )
inline

Definition at line 210 of file dart_api_state.h.

210 {
211 return reinterpret_cast<Dart_FinalizableHandle>(this);
212 }
struct _Dart_FinalizableHandle * Dart_FinalizableHandle
Definition: dart_api.h:261

◆ ApiWeakPersistentHandle()

Dart_WeakPersistentHandle dart::FinalizablePersistentHandle::ApiWeakPersistentHandle ( )
inline

Definition at line 207 of file dart_api_state.h.

207 {
208 return reinterpret_cast<Dart_WeakPersistentHandle>(this);
209 }
struct _Dart_WeakPersistentHandle * Dart_WeakPersistentHandle
Definition: dart_api.h:260

◆ auto_delete()

bool dart::FinalizablePersistentHandle::auto_delete ( ) const
inline

Definition at line 214 of file dart_api_state.h.

214{ return auto_delete_; }

◆ callback()

Dart_HandleFinalizer dart::FinalizablePersistentHandle::callback ( ) const
inline

Definition at line 206 of file dart_api_state.h.

206{ return callback_; }

◆ Cast() [1/2]

FinalizablePersistentHandle * dart::FinalizablePersistentHandle::Cast ( Dart_FinalizableHandle  handle)
static

Definition at line 708 of file dart_api_impl.cc.

709 {
710#if defined(DEBUG)
711 ApiState* state = IsolateGroup::Current()->api_state();
712 ASSERT(state->IsValidFinalizableHandle(handle));
713#endif
714 return reinterpret_cast<FinalizablePersistentHandle*>(handle);
715}
static IsolateGroup * Current()
Definition: isolate.h:539
ApiState * api_state() const
Definition: isolate.h:700
#define ASSERT(E)
AtkStateType state

◆ Cast() [2/2]

FinalizablePersistentHandle * dart::FinalizablePersistentHandle::Cast ( Dart_WeakPersistentHandle  handle)
static

Definition at line 700 of file dart_api_impl.cc.

701 {
702#if defined(DEBUG)
703 ApiState* state = IsolateGroup::Current()->api_state();
704 ASSERT(state->IsValidWeakPersistentHandle(handle));
705#endif
706 return reinterpret_cast<FinalizablePersistentHandle*>(handle);
707}

◆ EnsureFreedExternal()

void dart::FinalizablePersistentHandle::EnsureFreedExternal ( IsolateGroup isolate_group)
inline

Definition at line 255 of file dart_api_state.h.

255 {
256 isolate_group->heap()->FreedExternal(external_size(), SpaceForExternal());
257 set_external_size(0);
258 }

◆ external_size()

intptr_t dart::FinalizablePersistentHandle::external_size ( ) const
inline

Definition at line 220 of file dart_api_state.h.

220 {
221 return ExternalSizeInWordsBits::decode(external_data_) * kWordSize;
222 }
constexpr intptr_t kWordSize
Definition: globals.h:509
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ IsFinalizedNotFreed()

bool dart::FinalizablePersistentHandle::IsFinalizedNotFreed ( ) const
inline

Definition at line 216 of file dart_api_state.h.

216 {
217 return ptr_ == static_cast<ObjectPtr>(reinterpret_cast<uword>(this));
218 }
uintptr_t uword
Definition: globals.h:501

◆ New()

FinalizablePersistentHandle * dart::FinalizablePersistentHandle::New ( IsolateGroup isolate_group,
const Object object,
void *  peer,
Dart_HandleFinalizer  callback,
intptr_t  external_size,
bool  auto_delete 
)
inlinestatic

Definition at line 790 of file dart_api_state.h.

796 {
797 ApiState* state = isolate_group->api_state();
798 ASSERT(state != nullptr);
799 FinalizablePersistentHandle* ref = state->AllocateWeakPersistentHandle();
800 ref->set_ptr(object);
801 ref->set_peer(peer);
802 ref->set_callback(callback);
803 ref->set_auto_delete(auto_delete);
804 // This may trigger GC, so it must be called last.
805 if (!(ref->SetExternalSize(external_size, isolate_group))) {
806 state->FreeWeakPersistentHandle(ref);
807 return nullptr;
808 }
809 return ref;
810}
Dart_HandleFinalizer callback() const

◆ peer()

void * dart::FinalizablePersistentHandle::peer ( ) const
inline

Definition at line 205 of file dart_api_state.h.

205{ return peer_; }

◆ ptr()

ObjectPtr dart::FinalizablePersistentHandle::ptr ( ) const
inline

Definition at line 200 of file dart_api_state.h.

200{ return ptr_; }

◆ ptr_addr()

ObjectPtr * dart::FinalizablePersistentHandle::ptr_addr ( )
inline

Definition at line 201 of file dart_api_state.h.

201{ return &ptr_; }

◆ ptr_offset()

static intptr_t dart::FinalizablePersistentHandle::ptr_offset ( )
inlinestatic

Definition at line 202 of file dart_api_state.h.

202 {
203 return OFFSET_OF(FinalizablePersistentHandle, ptr_);
204 }
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ SetExternalSize()

bool dart::FinalizablePersistentHandle::SetExternalSize ( intptr_t  size,
IsolateGroup isolate_group 
)
inline

Definition at line 224 of file dart_api_state.h.

224 {
225 // This method only behaves correctly when external_size() has not been
226 // previously modified.
227 ASSERT(external_size() == 0);
228 if (size < 0 || (size >> kWordSizeLog2) > kMaxAddrSpaceInWords) {
229 return false;
230 }
231 set_external_size(size);
232 if (SpaceForExternal() == Heap::kNew) {
233 SetExternalNewSpaceBit();
234 }
235 return isolate_group->heap()->AllocatedExternal(external_size(),
236 SpaceForExternal());
237 }
@ kNew
Definition: heap.h:38
constexpr intptr_t kWordSizeLog2
Definition: globals.h:507
const intptr_t kMaxAddrSpaceInWords
Definition: globals.h:50
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

◆ UpdateRelocated()

void dart::FinalizablePersistentHandle::UpdateRelocated ( IsolateGroup isolate_group)
inline

Definition at line 246 of file dart_api_state.h.

246 {
247 if (IsSetNewSpaceBit() && (SpaceForExternal() == Heap::kOld)) {
248 isolate_group->heap()->PromotedExternal(external_size());
249 ClearExternalNewSpaceBit();
250 }
251 }
@ kOld
Definition: heap.h:39

◆ UpdateUnreachable()

void dart::FinalizablePersistentHandle::UpdateUnreachable ( IsolateGroup isolate_group)
inline

Definition at line 240 of file dart_api_state.h.

240 {
241 EnsureFreedExternal(isolate_group);
242 Finalize(isolate_group, this);
243 }
void EnsureFreedExternal(IsolateGroup *isolate_group)

Friends And Related Function Documentation

◆ FinalizablePersistentHandles

friend class FinalizablePersistentHandles
friend

Definition at line 280 of file dart_api_state.h.


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