#include <file_loader.h>
Definition at line 19 of file file_loader.h.
◆ FileLoader()
tonic::FileLoader::FileLoader |
( |
int |
dirfd = -1 | ) |
|
|
explicit |
◆ ~FileLoader()
tonic::FileLoader::~FileLoader |
( |
| ) |
|
Definition at line 51 of file file_loader.cc.
51 {
52 for (auto kernel_buffer : kernel_buffers_)
53 free(kernel_buffer);
54
55 if (dirfd_ >= 0)
56 close(dirfd_);
57}
◆ CanonicalizeURL()
Definition at line 133 of file file_loader.cc.
133 {
135 if (
string.
find(kDartScheme) == 0u)
136 return url;
137 if (
string.
find(kPackageScheme) == 0u)
139
140 if (
string.
find(kFileScheme) == 0u) {
142 }
143
145 std::string
prefix = ExtractSchemePrefix(library_url);
146 std::string base_path = ExtractPath(library_url);
147 std::string simplified_path =
151}
int find(T *array, int N, T item)
static const std::string kPathSeparator
DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library)
std::string GetDirectoryName(const std::string &path)
std::string SimplifyPath(std::string path)
Dart_Handle StdStringToDart(const std::string &val)
std::string StdStringFromDart(Dart_Handle handle)
◆ FetchBytes()
Dart_Handle tonic::FileLoader::FetchBytes |
( |
const std::string & |
url, |
|
|
uint8_t *& |
buffer, |
|
|
intptr_t & |
buffer_size |
|
) |
| |
Definition at line 161 of file file_loader.cc.
163 {
166
169 std::string error_message = "error: Unable to read '" + url + "'.";
172 }
175 if (
result.first ==
nullptr) {
176 std::string error_message =
177 "error: Unable to read '" + absolute_path + "'.";
180 }
184}
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
DART_EXPORT Dart_Handle Dart_True(void)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception)
static const uint8_t buffer[]
std::string GetAbsoluteFilePath(const std::string &path)
std::pair< uint8_t *, intptr_t > ReadFileToBytes(const std::string &path)
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
◆ HandleLibraryTag()
Definition at line 118 of file file_loader.cc.
120 {
131}
Dart_Handle Import(Dart_Handle url)
Dart_Handle CanonicalizeURL(Dart_Handle library, Dart_Handle url)
Dart_Handle Kernel(Dart_Handle url)
DART_EXPORT Dart_Handle Dart_NewApiError(const char *error)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT bool Dart_IsString(Dart_Handle object)
DART_EXPORT bool Dart_IsLibrary(Dart_Handle object)
◆ Import()
Definition at line 186 of file file_loader.cc.
186 {
188 uint8_t*
buffer =
nullptr;
193 }
194
195 kernel_buffers_.push_back(
buffer);
197}
Dart_Handle FetchBytes(const std::string &url, uint8_t *&buffer, intptr_t &buffer_size)
struct _Dart_Handle * Dart_Handle
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibraryFromKernel(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
◆ Kernel()
Definition at line 205 of file file_loader.cc.
205 {
207 uint8_t*
buffer =
nullptr;
212 }
217}
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, void *data, intptr_t length)
◆ LoadPackagesMap()
bool tonic::FileLoader::LoadPackagesMap |
( |
const std::string & |
packages | ) |
|
Definition at line 79 of file file_loader.cc.
79 {
81 std::string packages_source;
82 if (!ReadFileToString(packages_, &packages_source)) {
83 tonic::Log(
"error: Unable to load .packages file '%s'.", packages_.c_str());
84 return false;
85 }
86 packages_map_.reset(new PackagesMap());
88 if (!packages_map_->Parse(packages_source, &
error)) {
89 tonic::Log(
"error: Unable to parse .packages file '%s'. %s",
90 packages_.c_str(),
error.c_str());
91 return false;
92 }
93 return true;
94}
const std::string & packages() const
const uint8_t uint32_t uint32_t GError ** error
void Log(const char *format,...)
◆ packages()
const std::string & tonic::FileLoader::packages |
( |
| ) |
const |
|
inline |
◆ SetPackagesUrl()
void tonic::FileLoader::SetPackagesUrl |
( |
Dart_Handle |
url | ) |
|
Definition at line 220 of file file_loader.cc.
220 {
222
224 return;
225 }
228}
bool LoadPackagesMap(const std::string &packages)
DART_EXPORT Dart_Handle Dart_Null(void)
◆ kFileURLPrefix
const char tonic::FileLoader::kFileURLPrefix = "file://" |
|
static |
◆ kFileURLPrefixLength
const size_t tonic::FileLoader::kFileURLPrefixLength |
|
static |
Initial value:=
static const char kFileURLPrefix[]
Definition at line 43 of file file_loader.h.
◆ kPathSeparator
const std::string tonic::FileLoader::kPathSeparator = "/" |
|
static |
The documentation for this class was generated from the following files: