Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
flutter::DartRuntimeHooks Class Reference

#include <dart_runtime_hooks.h>

Static Public Member Functions

static void Install (bool is_ui_isolate, const std::string &script_uri)
 
static void Logger_PrintDebugString (const std::string &message)
 
static void Logger_PrintString (const std::string &message)
 
static void ScheduleMicrotask (Dart_Handle closure)
 
static Dart_Handle GetCallbackHandle (Dart_Handle func)
 
static Dart_Handle GetCallbackFromHandle (int64_t handle)
 

Detailed Description

Definition at line 14 of file dart_runtime_hooks.h.

Member Function Documentation

◆ GetCallbackFromHandle()

Dart_Handle flutter::DartRuntimeHooks::GetCallbackFromHandle ( int64_t  handle)
static

Definition at line 263 of file dart_runtime_hooks.cc.

263 {
266 return result;
267}
static Dart_Handle GetCallback(int64_t handle)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
GAsyncResult * result
static void PropagateIfError(Dart_Handle result)

◆ GetCallbackHandle()

Dart_Handle flutter::DartRuntimeHooks::GetCallbackHandle ( Dart_Handle  func)
static

Definition at line 247 of file dart_runtime_hooks.cc.

247 {
248 std::string name = GetFunctionName(func);
249 std::string class_name = GetFunctionClassName(func);
250 std::string library_path = GetFunctionLibraryUrl(func);
251
252 // `name` is empty if `func` can't be used as a callback. This is the case
253 // when `func` is not a function object or is not a static function. Anonymous
254 // closures (e.g. `(int a, int b) => a + b;`) also cannot be used as
255 // callbacks, so `func` must be a tear-off of a named static function.
256 if (!Dart_IsTearOff(func) || name.empty()) {
257 return Dart_Null();
258 }
260 DartCallbackCache::GetCallbackHandle(name, class_name, library_path));
261}
static int64_t GetCallbackHandle(const std::string &name, const std::string &class_name, const std::string &library_path)
DART_EXPORT Dart_Handle Dart_Null(void)
DART_EXPORT bool Dart_IsTearOff(Dart_Handle object)
const char *const class_name
static std::string GetFunctionClassName(Dart_Handle closure)
static std::string GetFunctionName(Dart_Handle func)
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32
static std::string GetFunctionLibraryUrl(Dart_Handle closure)

◆ Install()

void flutter::DartRuntimeHooks::Install ( bool  is_ui_isolate,
const std::string &  script_uri 
)
static

Definition at line 134 of file dart_runtime_hooks.cc.

135 {
136 Dart_Handle builtin = Dart_LookupLibrary(ToDart("dart:ui"));
137 InitDartInternal(builtin, is_ui_isolate);
138 InitDartCore(builtin, script_uri);
139 InitDartAsync(builtin, is_ui_isolate);
140 InitDartIO(builtin, script_uri);
141}
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
static void InitDartIO(Dart_Handle builtin_library, const std::string &script_uri)
static void InitDartInternal(Dart_Handle builtin_library, bool is_ui_isolate)
static void InitDartCore(Dart_Handle builtin, const std::string &script_uri)
static void InitDartAsync(Dart_Handle builtin_library, bool is_ui_isolate)
Dart_Handle ToDart(const T &object)

◆ Logger_PrintDebugString()

void flutter::DartRuntimeHooks::Logger_PrintDebugString ( const std::string &  message)
static

Definition at line 143 of file dart_runtime_hooks.cc.

143 {
144#ifndef NDEBUG
146#endif
147}
static void Logger_PrintString(const std::string &message)
Win32Message message

◆ Logger_PrintString()

void flutter::DartRuntimeHooks::Logger_PrintString ( const std::string &  message)
static

Definition at line 149 of file dart_runtime_hooks.cc.

149 {
150 const auto& tag = UIDartState::Current()->logger_prefix();
152
154 std::stringstream stream;
155 if (!tag.empty()) {
156 stream << tag << ": ";
157 }
158 stream << message;
159 std::string log = stream.str();
160
161 // For now we report print output on the Stdout stream.
162 uint8_t newline[] = {'\n'};
163 Dart_ServiceSendDataEvent("Stdout", "WriteEvent",
164 reinterpret_cast<const uint8_t*>(log.c_str()),
165 log.size());
166 Dart_ServiceSendDataEvent("Stdout", "WriteEvent", newline, sizeof(newline));
167 }
168}
const std::string & logger_prefix() const
void LogMessage(const std::string &tag, const std::string &message) const
static UIDartState * Current()
DART_EXPORT char * Dart_ServiceSendDataEvent(const char *stream_id, const char *event_kind, const uint8_t *bytes, intptr_t bytes_length)
bool ShouldCaptureStdout()

◆ ScheduleMicrotask()

void flutter::DartRuntimeHooks::ScheduleMicrotask ( Dart_Handle  closure)
static

Definition at line 170 of file dart_runtime_hooks.cc.

170 {
172}
void ScheduleMicrotask(Dart_Handle handle)

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