5#ifndef FLUTTER_FML_MAPPING_H_
6#define FLUTTER_FML_MAPPING_H_
8#include <initializer_list>
13#include "flutter/fml/build_config.h"
14#include "flutter/fml/file.h"
15#include "flutter/fml/macros.h"
16#include "flutter/fml/native_library.h"
17#include "flutter/fml/unique_fd.h"
36 FML_DISALLOW_COPY_AND_ASSIGN(
Mapping);
48 std::initializer_list<Protection> protection = {
57 const std::string& sub_path =
"");
60 const std::string&
path);
64 const std::string& sub_path =
"");
67 size_t GetSize()
const override;
82 uint8_t* mapping_ =
nullptr;
83 uint8_t* mutable_mapping_ =
nullptr;
101 size_t GetSize()
const override;
110 std::vector<uint8_t> data_;
121 bool dontneed_safe =
false);
126 size_t GetSize()
const override;
135 const uint8_t*
const data_;
138 const bool dontneed_safe_;
161 template <
typename T>
175 size_t GetSize()
const override;
185 [[nodiscard]] uint8_t*
Release();
197 const char* symbol_name);
202 size_t GetSize()
const override;
212 const uint8_t* mapping_ =
nullptr;
const uint8_t * GetMapping() const override
bool IsDontNeedSafe() const override
size_t GetSize() const override
DataMapping(std::vector< uint8_t > data)
FileMapping(const fml::UniqueFD &fd, std::initializer_list< Protection > protection={ Protection::kRead})
static std::unique_ptr< FileMapping > CreateReadExecute(const std::string &path)
size_t GetSize() const override
bool IsDontNeedSafe() const override
uint8_t * GetMutableMapping()
static std::unique_ptr< FileMapping > CreateReadOnly(const std::string &path)
const uint8_t * GetMapping() const override
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
virtual bool IsDontNeedSafe() const =0
virtual const uint8_t * GetMapping() const =0
virtual size_t GetSize() const =0
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_DCHECK(condition)
Dart_NativeFunction function
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])
std::shared_ptr< const fml::Mapping > data