Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::bin::elf::MemoryMappable Class Reference
Inheritance diagram for dart::bin::elf::MemoryMappable:
dart::bin::elf::Mappable

Public Member Functions

 MemoryMappable (const uint8_t *memory, size_t size)
 
 ~MemoryMappable () override
 
MappedMemoryMap (File::MapType type, uint64_t position, uint64_t length, void *start=nullptr) override
 
bool SetPosition (uint64_t position) override
 
bool ReadFully (void *dest, int64_t length) override
 
- Public Member Functions inherited from dart::bin::elf::Mappable
virtual MappedMemoryMap (File::MapType type, uint64_t position, uint64_t length, void *start=nullptr)=0
 
virtual bool SetPosition (uint64_t position)=0
 
virtual bool ReadFully (void *dest, int64_t length)=0
 
virtual ~Mappable ()
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::bin::elf::Mappable
static MappableFromPath (const char *path)
 
static MappableFromMemory (const uint8_t *memory, size_t size)
 
- Protected Member Functions inherited from dart::bin::elf::Mappable
 Mappable ()
 

Detailed Description

Definition at line 77 of file elf_loader.cc.

Constructor & Destructor Documentation

◆ MemoryMappable()

dart::bin::elf::MemoryMappable::MemoryMappable ( const uint8_t *  memory,
size_t  size 
)
inline

Definition at line 79 of file elf_loader.cc.

80 : Mappable(), memory_(memory), size_(size), position_(memory) {}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ ~MemoryMappable()

dart::bin::elf::MemoryMappable::~MemoryMappable ( )
inlineoverride

Definition at line 82 of file elf_loader.cc.

82{}

Member Function Documentation

◆ Map()

MappedMemory * dart::bin::elf::MemoryMappable::Map ( File::MapType  type,
uint64_t  position,
uint64_t  length,
void *  start = nullptr 
)
inlineoverridevirtual

Implements dart::bin::elf::Mappable.

Definition at line 84 of file elf_loader.cc.

87 {
88 if (position > size_) return nullptr;
89 MappedMemory* result = nullptr;
91 if (start == nullptr) {
92 auto* memory = VirtualMemory::Allocate(
93 map_size, type == File::kReadExecute, "dart-compiled-image");
94 if (memory == nullptr) return nullptr;
95 result = new MappedMemory(memory->address(), memory->size());
96 memory->release();
97 delete memory;
98 } else {
99 result = new MappedMemory(start, map_size,
100 /*should_unmap=*/false);
101 }
102
103 size_t remainder = 0;
104 if ((position + length) > size_) {
105 remainder = position + length - size_;
106 length = size_ - position;
107 }
108 memcpy(result->address(), memory_ + position, length); // NOLINT
109 memset(reinterpret_cast<uint8_t*>(result->address()) + length, 0,
110 remainder);
111
113 switch (type) {
116 break;
117 case File::kReadWrite:
119 break;
120 case File::kReadOnly:
122 break;
123 default:
124 UNREACHABLE();
125 }
126
127 VirtualMemory::Protect(result->address(), result->size(), mode);
128
129 return result;
130 }
#define UNREACHABLE()
Definition: assert.h:248
GLenum type
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition: utils.h:120
@ kReadExecute
Definition: file.h:122
static VirtualMemory * Allocate(intptr_t size, bool is_executable, const char *name)
static void Protect(void *address, intptr_t size, Protection mode)
static intptr_t PageSize()
GAsyncResult * result
size_t length
uintptr_t uword
Definition: globals.h:501
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ ReadFully()

bool dart::bin::elf::MemoryMappable::ReadFully ( void *  dest,
int64_t  length 
)
inlineoverridevirtual

Implements dart::bin::elf::Mappable.

Definition at line 138 of file elf_loader.cc.

138 {
139 if ((position_ + length) > (memory_ + size_)) return false;
140 memcpy(dest, position_, length);
141 return true;
142 }
dest
Definition: zip.py:79

◆ SetPosition()

bool dart::bin::elf::MemoryMappable::SetPosition ( uint64_t  position)
inlineoverridevirtual

Implements dart::bin::elf::Mappable.

Definition at line 132 of file elf_loader.cc.

132 {
133 if (position > size_) return false;
134 position_ = memory_ + position;
135 return true;
136 }

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