33 const auto reserved = npot ? ReserveNPOT(
length) : Reserve(
length);
57bool Allocation::ReserveNPOT(
size_t reserved) {
59 reserved = std::max<size_t>(4096u, reserved);
63bool Allocation::Reserve(
size_t reserved) {
64 if (reserved <= reserved_) {
68 auto new_allocation =
::realloc(buffer_, reserved);
69 if (!new_allocation) {
77 buffer_ =
static_cast<uint8_t*
>(new_allocation);
85 if (contents ==
nullptr) {
89 auto allocation = std::make_shared<Allocation>();
90 if (!allocation->Truncate(
length)) {
94 std::memmove(allocation->GetBuffer(), contents,
length);
100 const std::shared_ptr<Allocation>& allocation) {
104 return std::make_shared<fml::NonOwnedMapping>(
105 reinterpret_cast<const uint8_t*
>(allocation->GetBuffer()),
106 allocation->GetLength(),
107 [allocation](
auto,
auto) {}
112 auto buffer = std::make_shared<std::string>(std::move(
string));
113 return std::make_unique<fml::NonOwnedMapping>(
114 reinterpret_cast<const uint8_t*
>(
buffer->c_str()),
buffer->length(),
uint8_t * GetBuffer() const
size_t GetReservedLength() const
bool Truncate(size_t length, bool npot=true)
static uint32_t NextPowerOfTwoSize(uint32_t x)
void * realloc(void *ptr, 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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
std::shared_ptr< fml::Mapping > CreateMappingWithCopy(const uint8_t *contents, size_t length)
std::shared_ptr< fml::Mapping > CreateMappingWithString(std::string string)
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)