29 size_t storageSize = this->bytes(
size);
31 memcpy(fStorage,
src, storageSize);
36 :
SkTDStorage{that.fStorage, that.fSize, that.fSizeOfT} {}
40 if (that.fSize <= fCapacity) {
53 : fSizeOfT{that.fSizeOfT}
54 , fStorage(
std::exchange(that.fStorage, nullptr))
55 , fCapacity{that.fCapacity}
56 , fSize{that.fSize} {}
71 const int sizeOfT = fSizeOfT;
79 swap(fStorage, that.fStorage);
80 swap(fCapacity, that.fCapacity);
81 swap(fSize, that.fSize);
86 if (newSize > fCapacity) {
94 if (newCapacity > fCapacity) {
104 int growth = 4 + ((newCapacity + 4) >> 2);
108 expandedReserve = newCapacity + growth;
118 expandedReserve = (expandedReserve + 15) & ~15;
121 fCapacity = expandedReserve;
122 size_t newStorageSize = this->bytes(fCapacity);
123 fStorage =
static_cast<std::byte*
>(
sk_realloc_throw(fStorage, newStorageSize));
128 if (fCapacity != fSize) {
133 fStorage =
static_cast<std::byte*
>(
sk_realloc_throw(fStorage, this->bytes(fCapacity)));
144 SkASSERT(0 <= index && index <= fSize);
148 const int newCount = this->calculateSizeOrDie(-
count);
149 this->moveTail(index, index +
count, fSize);
156 SkASSERT(0 <= index && index < fSize);
158 const int newCount = this->calculateSizeOrDie(-1);
159 this->moveTail(index, fSize - 1, fSize);
168 if (fSize < fCapacity) {
178 if (fCapacity - fSize >=
count) {
190 return this->
insert(index, 1,
nullptr);
194 SkASSERT(0 <= index && index <= fSize);
198 const int oldCount = fSize;
199 const int newCount = this->calculateSizeOrDie(
count);
201 this->moveTail(index +
count, index, oldCount);
203 if (
src !=
nullptr) {
208 return this->address(index);
212 return a.size() ==
b.size() && (
a.empty() || !memcmp(
a.data(),
b.data(),
a.bytes(
a.size())));
215int SkTDStorage::calculateSizeOrDie(
int delta) {
222 static_assert(UINT32_MAX >= (uint32_t)INT_MAX + (uint32_t)INT_MAX);
228void SkTDStorage::moveTail(
int to,
int tailStart,
int tailEnd) {
230 SkASSERT(0 <= tailStart && tailStart <= tailEnd && tailEnd <= fSize);
231 if (to != tailStart && tailStart != tailEnd) {
232 this->copySrc(to, this->address(tailStart), tailEnd - tailStart);
236void SkTDStorage::copySrc(
int dstIndex,
const void*
src,
int count) {
238 memmove(this->address(dstIndex),
src, this->bytes(
count));
static const size_t testCount
#define SkASSERT_RELEASE(cond)
SK_API void sk_free(void *)
static void * sk_malloc_throw(size_t size)
SK_API void * sk_realloc_throw(void *buffer, size_t size)
void swap(sk_sp< T > &a, sk_sp< T > &b)
bool operator==(const SkTDStorage &a, const SkTDStorage &b)
constexpr int SkToInt(S x)
void erase(int index, int count)
void removeShuffle(int index)
void reserve(int newCapacity)
void swap(SkTDStorage &that)
size_t size_bytes() const
SkTDStorage & operator=(const SkTDStorage &that)
static constexpr size_t kMaxCount
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