5#ifndef LIB_TONIC_DART_STATE_H_
6#define LIB_TONIC_DART_STATE_H_
12#include "third_party/dart/runtime/include/dart_api.h"
19class DartClassLibrary;
20class DartMessageHandler;
28class DartState :
public std::enable_shared_from_this<DartState> {
33 explicit Scope(std::shared_ptr<DartState> dart_state);
57 return private_constructor_name_.
Get();
65 if (message_epilogue_) {
66 message_epilogue_(message_result);
88 std::unique_ptr<DartClassLibrary> class_library_;
89 std::unique_ptr<DartMessageHandler> message_handler_;
90 std::unique_ptr<FileLoader> file_loader_;
93 bool has_set_return_code_;
94 std::atomic<bool> is_shutting_down_;
Scope(DartState *dart_state)
TONIC_DISALLOW_COPY_AND_ASSIGN(DartState)
virtual void DidSetIsolate()
void SetReturnCode(uint32_t return_code)
static DartState * From(Dart_Isolate isolate)
void SetIsolate(Dart_Isolate isolate)
DartMessageHandler & message_handler()
void MessageEpilogue(Dart_Handle message_result)
DartState(int dirfd=-1, std::function< void(Dart_Handle)> message_epilogue=nullptr)
bool has_set_return_code() const
FileLoader & file_loader()
void SetReturnCodeCallback(std::function< void(uint32_t)> callback)
std::weak_ptr< DartState > GetWeakPtr()
static DartState * Current()
Dart_PersistentHandle private_constructor_name()
DartClassLibrary & class_library()
static Dart_Handle HandleLibraryTag(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)
Dart_Isolate isolate() const
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
Dart_Handle Dart_PersistentHandle
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function