Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
tonic::DartState Class Reference

#include <dart_state.h>

Inheritance diagram for tonic::DartState:
flutter::UIDartState flutter::DartIsolate

Classes

class  Scope
 

Public Member Functions

 DartState (int dirfd=-1, std::function< void(Dart_Handle)> message_epilogue=nullptr)
 
virtual ~DartState ()
 
std::weak_ptr< DartStateGetWeakPtr ()
 
Dart_Isolate isolate ()
 
void SetIsolate (Dart_Isolate isolate)
 
Dart_PersistentHandle private_constructor_name ()
 
DartClassLibraryclass_library ()
 
DartMessageHandlermessage_handler ()
 
FileLoaderfile_loader ()
 
void MessageEpilogue (Dart_Handle message_result)
 
void SetReturnCode (uint32_t return_code)
 
void SetReturnCodeCallback (std::function< void(uint32_t)> callback)
 
bool has_set_return_code () const
 
void SetIsShuttingDown ()
 
bool IsShuttingDown ()
 
virtual void DidSetIsolate ()
 

Static Public Member Functions

static DartStateFrom (Dart_Isolate isolate)
 
static DartStateCurrent ()
 
static Dart_Handle HandleLibraryTag (Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)
 

Protected Member Functions

Dart_Isolate isolate () const
 
 TONIC_DISALLOW_COPY_AND_ASSIGN (DartState)
 

Detailed Description

Definition at line 28 of file dart_state.h.

Constructor & Destructor Documentation

◆ DartState()

tonic::DartState::DartState ( int  dirfd = -1,
std::function< void(Dart_Handle)>  message_epilogue = nullptr 
)
explicit

Definition at line 22 of file dart_state.cc.

24 : isolate_(nullptr),
25 private_constructor_name_(),
26 class_library_(new DartClassLibrary),
27 message_handler_(new DartMessageHandler()),
28 file_loader_(new FileLoader(dirfd)),
29 message_epilogue_(message_epilogue),
30 has_set_return_code_(false),
31 is_shutting_down_(false) {}

◆ ~DartState()

tonic::DartState::~DartState ( )
virtual

Definition at line 33 of file dart_state.cc.

33{}

Member Function Documentation

◆ class_library()

DartClassLibrary & tonic::DartState::class_library ( )
inline

Definition at line 60 of file dart_state.h.

60{ return *class_library_; }

◆ Current()

DartState * tonic::DartState::Current ( )
static

Definition at line 56 of file dart_state.cc.

56 {
57 auto isolate_data =
58 static_cast<std::shared_ptr<DartState>*>(Dart_CurrentIsolateData());
59 return isolate_data ? isolate_data->get() : nullptr;
60}
DART_EXPORT void * Dart_CurrentIsolateData(void)

◆ DidSetIsolate()

void tonic::DartState::DidSetIsolate ( )
virtual

Reimplemented in flutter::UIDartState.

Definition at line 77 of file dart_state.cc.

77{}

◆ file_loader()

FileLoader & tonic::DartState::file_loader ( )
inline

Definition at line 62 of file dart_state.h.

62{ return *file_loader_; }

◆ From()

DartState * tonic::DartState::From ( Dart_Isolate  isolate)
static

Definition at line 50 of file dart_state.cc.

50 {
51 auto isolate_data =
52 static_cast<std::shared_ptr<DartState>*>(Dart_IsolateData(isolate));
53 return isolate_data->get();
54}
Dart_Isolate isolate()
Definition dart_state.h:51
DART_EXPORT void * Dart_IsolateData(Dart_Isolate isolate)

◆ GetWeakPtr()

std::weak_ptr< DartState > tonic::DartState::GetWeakPtr ( )

Definition at line 62 of file dart_state.cc.

62 {
63 return shared_from_this();
64}

◆ HandleLibraryTag()

Dart_Handle tonic::DartState::HandleLibraryTag ( Dart_LibraryTag  tag,
Dart_Handle  library,
Dart_Handle  url 
)
static

Definition at line 79 of file dart_state.cc.

81 {
82 return Current()->file_loader().HandleLibraryTag(tag, library, url);
83}
FileLoader & file_loader()
Definition dart_state.h:62
static DartState * Current()
Definition dart_state.cc:56
Dart_Handle HandleLibraryTag(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)

◆ has_set_return_code()

bool tonic::DartState::has_set_return_code ( ) const
inline

Definition at line 71 of file dart_state.h.

71{ return has_set_return_code_; }

◆ isolate() [1/2]

Dart_Isolate tonic::DartState::isolate ( )
inline

Definition at line 51 of file dart_state.h.

51{ return isolate_; }

◆ isolate() [2/2]

Dart_Isolate tonic::DartState::isolate ( ) const
inlineprotected

Definition at line 83 of file dart_state.h.

83{ return isolate_; }

◆ IsShuttingDown()

bool tonic::DartState::IsShuttingDown ( )
inline

Definition at line 74 of file dart_state.h.

74{ return is_shutting_down_; }

◆ message_handler()

DartMessageHandler & tonic::DartState::message_handler ( )
inline

Definition at line 61 of file dart_state.h.

61{ return *message_handler_; }

◆ MessageEpilogue()

void tonic::DartState::MessageEpilogue ( Dart_Handle  message_result)
inline

Definition at line 64 of file dart_state.h.

64 {
65 if (message_epilogue_) {
66 message_epilogue_(message_result);
67 }
68 }

◆ private_constructor_name()

Dart_PersistentHandle tonic::DartState::private_constructor_name ( )
inline

Definition at line 56 of file dart_state.h.

56 {
57 return private_constructor_name_.Get();
58 }

◆ SetIsolate()

void tonic::DartState::SetIsolate ( Dart_Isolate  isolate)

Definition at line 35 of file dart_state.cc.

35 {
36 isolate_ = isolate;
37
38 if (!isolate_)
39 return;
40
41 private_constructor_name_.Clear();
43 private_constructor_name_.Set(
46
48}
void Set(DartState *dart_state, Dart_Handle value)
virtual void DidSetIsolate()
Definition dart_state.cc:77
DART_EXPORT void Dart_EnterScope(void)
DART_EXPORT void Dart_ExitScope(void)
DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)

◆ SetIsShuttingDown()

void tonic::DartState::SetIsShuttingDown ( )
inline

Definition at line 73 of file dart_state.h.

73{ is_shutting_down_ = true; }

◆ SetReturnCode()

void tonic::DartState::SetReturnCode ( uint32_t  return_code)

Definition at line 66 of file dart_state.cc.

66 {
67 if (set_return_code_callback_) {
68 set_return_code_callback_(return_code);
69 }
70 has_set_return_code_ = true;
71}

◆ SetReturnCodeCallback()

void tonic::DartState::SetReturnCodeCallback ( std::function< void(uint32_t)>  callback)

Definition at line 73 of file dart_state.cc.

73 {
74 set_return_code_callback_ = callback;
75}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ TONIC_DISALLOW_COPY_AND_ASSIGN()

tonic::DartState::TONIC_DISALLOW_COPY_AND_ASSIGN ( DartState  )
protected

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