5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_MAPPED_RESOURCE_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_MAPPED_RESOURCE_H_
8#include <fuchsia/mem/cpp/fidl.h>
9#include <lib/fdio/namespace.h>
11#include "third_party/dart/runtime/bin/elf_loader.h"
20 other.handle_ =
nullptr;
27 bool Load(fdio_ns_t* namespc,
const std::string&
path);
28 bool Load(
int dirfd,
const std::string&
path);
30 const uint8_t*
VmData()
const {
return vm_data_; }
31 const uint8_t*
VmInstrs()
const {
return vm_instrs_; }
40 const uint8_t* vm_data_ =
nullptr;
41 const uint8_t* vm_instrs_ =
nullptr;
42 const uint8_t* isolate_data_ =
nullptr;
43 const uint8_t* isolate_instrs_ =
nullptr;
54 : address_(other.address_), size_(other.size_) {
55 other.address_ =
nullptr;
59 address_ = other.address_;
61 other.address_ =
nullptr;
73 const std::string&
path,
75 bool executable =
false);
80 const std::string&
path,
82 bool executable =
false);
88 fuchsia::mem::Buffer resource_vmo,
90 bool executable =
false);
93 return reinterpret_cast<const uint8_t*
>(address_);
95 size_t size()
const {
return size_; }
static SkString resource(SkPDFResourceType type, int index)
void swap(sk_sp< T > &a, sk_sp< T > &b)
ElfSnapshot(ElfSnapshot &&other)
bool Load(fdio_ns_t *namespc, const std::string &path)
const uint8_t * VmData() const
const uint8_t * IsolateData() const
const uint8_t * VmInstrs() const
const uint8_t * IsolateInstrs() const
ElfSnapshot & operator=(ElfSnapshot &&other)
static bool LoadFromNamespace(fdio_ns_t *namespc, const std::string &path, MappedResource &resource, bool executable=false)
static bool LoadFromDir(int dirfd, const std::string &path, MappedResource &resource, bool executable=false)
static bool LoadFromVmo(const std::string &path, fuchsia::mem::Buffer resource_vmo, MappedResource &resource, bool executable=false)
const uint8_t * address() const
MappedResource & operator=(MappedResource &&other)
MappedResource(MappedResource &&other)
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