Lines Matching refs:alloc
12 static void check_alloc(skiatest::Reporter* reporter, const SkChunkAlloc& alloc, in check_alloc() argument
14 REPORTER_ASSERT(reporter, alloc.totalCapacity() >= capacity); in check_alloc()
15 REPORTER_ASSERT(reporter, alloc.totalUsed() == used); in check_alloc()
16 SkDEBUGCODE(REPORTER_ASSERT(reporter, alloc.blockCount() == numBlocks);) in check_alloc()
19 static void* simple_alloc(skiatest::Reporter* reporter, SkChunkAlloc* alloc, size_t size) { in simple_alloc() argument
20 void* ptr = alloc->allocThrow(size); in simple_alloc()
21 check_alloc(reporter, *alloc, size, size, 1); in simple_alloc()
22 REPORTER_ASSERT(reporter, alloc->contains(ptr)); in simple_alloc()
28 SkChunkAlloc alloc(kMin); in test_chunkalloc() local
32 check_alloc(reporter, alloc, 0, 0, 0); in test_chunkalloc()
33 REPORTER_ASSERT(reporter, !alloc.contains(nullptr)); in test_chunkalloc()
34 REPORTER_ASSERT(reporter, !alloc.contains(reporter)); in test_chunkalloc()
37 alloc.reset(); in test_chunkalloc()
38 check_alloc(reporter, alloc, 0, 0, 0); in test_chunkalloc()
41 alloc.rewind(); in test_chunkalloc()
42 check_alloc(reporter, alloc, 0, 0, 0); in test_chunkalloc()
47 void* ptr = simple_alloc(reporter, &alloc, size); in test_chunkalloc()
49 alloc.reset(); in test_chunkalloc()
50 check_alloc(reporter, alloc, 0, 0, 0); in test_chunkalloc()
51 REPORTER_ASSERT(reporter, !alloc.contains(ptr)); in test_chunkalloc()
55 ptr = simple_alloc(reporter, &alloc, size); in test_chunkalloc()
57 alloc.rewind(); in test_chunkalloc()
58 check_alloc(reporter, alloc, size, 0, 1); in test_chunkalloc()
59 REPORTER_ASSERT(reporter, !alloc.contains(ptr)); in test_chunkalloc()
62 ptr = simple_alloc(reporter, &alloc, size); in test_chunkalloc()
63 alloc.reset(); in test_chunkalloc()
67 ptr = simple_alloc(reporter, &alloc, size); in test_chunkalloc()
69 ptr = alloc.allocThrow(kMin); in test_chunkalloc()
70 check_alloc(reporter, alloc, 2*kMin, size+kMin, 2); in test_chunkalloc()
71 REPORTER_ASSERT(reporter, alloc.contains(ptr)); in test_chunkalloc()
75 size_t freed = alloc.unalloc(ptr); in test_chunkalloc()
77 check_alloc(reporter, alloc, 2*kMin, size, 2); in test_chunkalloc()
78 REPORTER_ASSERT(reporter, !alloc.contains(ptr)); in test_chunkalloc()