5#include "flutter/fml/mapping.h"
17 return mutable_mapping_;
21 const std::string&
path) {
28 const std::string& sub_path) {
29 if (!sub_path.empty()) {
34 auto mapping = std::make_unique<FileMapping>(
37 if (!mapping->IsValid()) {
45 const std::string&
path) {
52 const std::string& sub_path) {
53 if (!sub_path.empty()) {
58 auto mapping = std::make_unique<FileMapping>(
62 if (!mapping->IsValid()) {
74 : data_(string.
begin(), string.
end()) {}
97 release_proc_(release_proc),
98 dontneed_safe_(dontneed_safe) {}
102 release_proc_(data_, size_);
115 return dontneed_safe_;
125 : data_(mapping.data_), size_(mapping.size_) {
126 mapping.data_ =
nullptr;
165 const char* symbol_name)
166 : native_library_(
std::move(native_library)) {
167 if (native_library_ && symbol_name !=
nullptr) {
170 if (mapping_ ==
nullptr) {
177 std::stringstream underscore_symbol_name;
178 underscore_symbol_name <<
"_" << symbol_name;
180 native_library_->
ResolveSymbol(underscore_symbol_name.str().c_str());
const uint8_t * GetMapping() const override
bool IsDontNeedSafe() const override
size_t GetSize() const override
DataMapping(std::vector< uint8_t > data)
static std::unique_ptr< FileMapping > CreateReadExecute(const std::string &path)
uint8_t * GetMutableMapping()
static std::unique_ptr< FileMapping > CreateReadOnly(const std::string &path)
A Mapping like NonOwnedMapping, but uses Free as its release proc.
bool IsDontNeedSafe() const override
static MallocMapping Copy(const T *begin, const T *end)
size_t GetSize() const override
const uint8_t * GetMapping() const override
~MallocMapping() override
const uint8_t * ResolveSymbol(const char *symbol)
std::function< void(const uint8_t *data, size_t size)> ReleaseProc
const uint8_t * GetMapping() const override
size_t GetSize() const override
NonOwnedMapping(const uint8_t *data, size_t size, const ReleaseProc &release_proc=nullptr, bool dontneed_safe=false)
~NonOwnedMapping() override
bool IsDontNeedSafe() const override
bool IsDontNeedSafe() const override
~SymbolMapping() override
SymbolMapping(fml::RefPtr< fml::NativeLibrary > native_library, const char *symbol_name)
const uint8_t * GetMapping() const override
size_t GetSize() const override
static const char * begin(const StringSlice &s)
#define FML_CHECK(condition)
void * malloc(size_t size)
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
constexpr std::size_t size(T(&array)[N])
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
std::shared_ptr< const fml::Mapping > data