5 #ifndef FLUTTER_IMPELLER_BASE_ALLOCATION_H_
6 #define FLUTTER_IMPELLER_BASE_ALLOCATION_H_
11 #include "flutter/fml/mapping.h"
86 uint8_t* buffer_ =
nullptr;
90 [[nodiscard]]
bool Reserve(
Bytes reserved);
92 [[nodiscard]]
bool ReserveNPOT(
Bytes reserved);
124 const std::shared_ptr<Allocation>& allocation);
137 std::shared_ptr<const std::string>
string);
Describes an allocation on the heap.
uint8_t * GetBuffer() const
Gets the pointer to the start of the allocation.
Bytes GetReservedLength() const
Gets the reserved length of the allocation. Calls to truncate may be ignored till the length exceeds ...
~Allocation()
Destroys the allocation.
Allocation()
Constructs a new zero-sized allocation.
Bytes GetLength() const
Gets the length of the allocation.
bool Truncate(Bytes length, bool npot=true)
Resize the underlying allocation to at least given number of bytes.
static uint32_t NextPowerOfTwoSize(uint32_t x)
Gets the next power of two size.
std::shared_ptr< fml::Mapping > CreateMappingWithString(std::string string)
Creates a mapping with string data.
std::shared_ptr< fml::Mapping > CreateMappingWithCopy(const uint8_t *contents, Bytes length)
Creates a mapping with copy of the bytes.
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)
Creates a mapping from allocation.