Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
dart::bin::NativeAssets Class Reference

#include <native_assets_api.h>

Static Public Member Functions

static void * DlopenAbsolute (const char *path, char **error)
 
static void * DlopenRelative (const char *path, const char *script_uri, char **error)
 
static void * DlopenSystem (const char *path, char **error)
 
static void * DlopenProcess (char **error)
 
static void * DlopenExecutable (char **error)
 
static void * Dlsym (void *handle, const char *symbol, char **error)
 

Detailed Description

Definition at line 11 of file native_assets_api.h.

Member Function Documentation

◆ DlopenAbsolute()

void * dart::bin::NativeAssets::DlopenAbsolute ( const char *  path,
char **  error 
)
static

Definition at line 122 of file native_assets_api_impl.cc.

122 {
123 // If we'd want to be strict, it should not take into account include paths.
124 void* handle = LoadDynamicLibrary(path, error);
126 return handle;
127}
const uint8_t uint32_t uint32_t GError ** error
static void WrapError(const char *path, char **error)
static void * LoadDynamicLibrary(const char *library_file, char **error=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ DlopenExecutable()

void * dart::bin::NativeAssets::DlopenExecutable ( char **  error)
static

Definition at line 169 of file native_assets_api_impl.cc.

169 {
170 return LoadDynamicLibrary(nullptr, error);
171}

◆ DlopenProcess()

void * dart::bin::NativeAssets::DlopenProcess ( char **  error)
static

Definition at line 160 of file native_assets_api_impl.cc.

160 {
161#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
162 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
163 return RTLD_DEFAULT;
164#else
165 return kWindowsDynamicLibraryProcessPtr;
166#endif
167}

◆ DlopenRelative()

void * dart::bin::NativeAssets::DlopenRelative ( const char *  path,
const char *  script_uri,
char **  error 
)
static

Definition at line 129 of file native_assets_api_impl.cc.

131 {
132 void* handle = nullptr;
133 CStringUniquePtr platform_script_cstr = CleanScriptUri(script_uri);
134 const intptr_t len = strlen(path);
135 char* path_copy = reinterpret_cast<char*>(malloc(len + 1));
136 snprintf(path_copy, len + 1, "%s", path);
137#if defined(DART_TARGET_OS_WINDOWS)
138 ReplaceBackSlashes(path_copy);
139#endif
140 auto target_uri = ResolveUri(path_copy, platform_script_cstr.get());
141 if (!target_uri) {
142 SET_ERROR_MSG(error, "Failed to resolve '%s' relative to '%s'.", path_copy,
143 platform_script_cstr.get());
144 } else {
145 const char* target_path = target_uri.get() + file_schema_length;
146 handle = LoadDynamicLibrary(target_path, error);
147 }
148 free(path_copy);
149 WrapErrorRelative(path, script_uri, error);
150 return handle;
151}
const int file_schema_length
CStringUniquePtr CleanScriptUri(const char *script_uri)
static void WrapErrorRelative(const char *path, const char *script_uri, char **error)
CAllocUniquePtr< char > CStringUniquePtr
Definition: utils.h:31
void * malloc(size_t size)
Definition: allocation.cc:19
CStringUniquePtr ResolveUri(const char *ref_uri, const char *base_uri)
Definition: uri.cc:432
#define SET_ERROR_MSG(error_msg, format,...)
SKWASM_EXPORT SkPath * path_copy(SkPath *path)
Definition: path.cpp:20

◆ DlopenSystem()

void * dart::bin::NativeAssets::DlopenSystem ( const char *  path,
char **  error 
)
static

Definition at line 153 of file native_assets_api_impl.cc.

153 {
154 // Should take into account LD_PATH etc.
155 void* handle = LoadDynamicLibrary(path, error);
157 return handle;
158}

◆ Dlsym()

void * dart::bin::NativeAssets::Dlsym ( void *  handle,
const char *  symbol,
char **  error 
)
static

Definition at line 225 of file native_assets_api_impl.cc.

225 {
226 void* const result = ResolveSymbol(handle, symbol, error);
227 if (*error != nullptr) {
228 char* inner_error = *error;
229 SET_ERROR_MSG(error, "Failed to lookup symbol '%s': %s", symbol,
230 inner_error);
231 free(inner_error);
232 }
233 return result;
234}
GAsyncResult * result
static void * ResolveSymbol(void *handle, const char *symbol, char **error)

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