28 fChar =
static_cast<char>(v & 0xFF);
31 return fChar ==
static_cast<char>(v & 0xFF);
35 void*
operator new(
size_t size) {
37 return ::operator
new(
size);
39 return gPool->allocate(
size);
43 void operator delete(
void*
p) {
47 return gPool->release(
p);
53 static void SetAllocator(
size_t preallocSize,
size_t minAllocSize) {
66 static std::unique_ptr<GrMemoryPool> gPool;
70std::unique_ptr<GrMemoryPool> A::gPool;
76 fDouble =
static_cast<double>(v);
80 return fDouble ==
static_cast<double>(v) &&
94 fInt64 =
static_cast<int64_t
>(v);
98 return fInt64 ==
static_cast<int64_t
>(v) &&
115 fVoidStar =
reinterpret_cast<void*
>(
static_cast<intptr_t
>(v));
120 return fVoidStar ==
reinterpret_cast<void*
>(
static_cast<intptr_t
>(v)) &&
146 if (fIntArray[
i] != v) {
183 static const size_t gSizes[][2] = {
185 {10 *
sizeof(
A), 20 *
sizeof(
A)},
186 {100 *
sizeof(
A), 100 *
sizeof(
A)},
187 {500 *
sizeof(
A), 500 *
sizeof(
A)},
188 {10000 *
sizeof(
A), 0},
189 {1, 100 *
sizeof(
A)},
193 static const float gCreateFraction[] = {1.f, .95f, 0.75f, .5f};
195 static const int kNumIters = 20000;
198 static const int kCheckPeriod = 500;
204 for (
size_t c = 0; c <
std::size(gCreateFraction); ++c) {
206 for (
int i = 0;
i < kNumIters; ++
i) {
208 if (createOrDestroy < gCreateFraction[c] ||
209 0 == instanceRecs.
size()) {
216 Rec& rec = instanceRecs[
d];
221 if (0 ==
i % kCheckPeriod) {
223 for (
Rec& rec : instanceRecs) {
228 for (
Rec& rec : instanceRecs) {
230 delete rec.fInstance;
243 for (
void* ptr: fAllocated) {
260 size_t origPoolSize =
pool.size();
261 while (
pool.size() == origPoolSize) {
262 r.add(
pool.allocate(31));
277 allocateMemory(*
pool, r);
283 constexpr size_t kPreallocSize = kSmallestMinAllocSize * 5;
290 constexpr size_t kMinAllocSize = kSmallestMinAllocSize * 7;
295 allocateMemory(*
pool, r);
298 allocateMemory(*
pool, r);
305 constexpr size_t kMinAllocSize = kSmallestMinAllocSize * 2;
311 constexpr size_t hugeSize = 10 * kMinAllocSize;
312 r.
add(
pool->allocate(hugeSize));
317 size_t hugeBlockSize =
pool->size();
DEF_TEST(GrMemoryPool, reporter)
static bool ok(int result)
#define REPORTER_ASSERT(r, cond,...)
static A * Create(SkRandom *r)
static void ResetAllocator()
virtual void setValues(int v)
static void ValidatePool()
virtual bool checkValues(int v)
static void SetAllocator(size_t preallocSize, size_t minAllocSize)
AutoPoolReleaser(GrMemoryPool &pool)
bool checkValues(int v) override
void setValues(int v) override
void setValues(int v) override
bool checkValues(int v) override
void setValues(int v) override
bool checkValues(int v) override
void setValues(int v) override
bool checkValues(int v) override
static std::unique_ptr< GrMemoryPool > Make(size_t preallocSize, size_t minAllocSize)
static constexpr size_t kMinAllocationSize
uint32_t nextRangeU(uint32_t min, uint32_t max)
void removeShuffle(int index)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
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