class SK_SPI SkContainerAllocator { public:
SkContainerAllocator(size_t sizeOfT, int maxCapacity)
: fSizeOfT{sizeOfT}
, fMaxCapacity{maxCapacity} {}
// allocate will abort on failure. Given a capacity of 0, it will return the empty span. // The bytes allocated are freed using sk_free().
SkSpan<std::byte> allocate(int capacity, double growthFactor = 1.0);
// Rounds a requested capacity up towards `kCapacityMultiple` in a constexpr-friendly fashion. template <typename T> static constexpr size_t RoundUp(size_t capacity) { return SkAlignTo(capacity * sizeof(T), kCapacityMultiple) / sizeof(T);
}
// All capacity counts will be rounded up to kCapacityMultiple. This matches ASAN's shadow // granularity, as well as our typical struct alignment on a 64-bit machine. static constexpr int64_t kCapacityMultiple = 8;
// Rounds up capacity to next multiple of kCapacityMultiple and pin to fMaxCapacity.
size_t roundUpCapacity(int64_t capacity) const;
// Grows the capacity by growthFactor being sure to stay with in kMinBytes and fMaxCapacity.
size_t growthFactorCapacity(int capacity, double growthFactor) const;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.