From 9519d4f05a211c2d4a52ad1dacfe59ceeb884adb Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 7 Jun 2018 11:14:39 -0400 Subject: Remove unused GrObjectMemoryPool Change-Id: I8d37dfa3a5f0af4741eb6f1c10e13065d20b0ccb Reviewed-on: https://skia-review.googlesource.com/132829 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- tests/GrMemoryPoolTest.cpp | 77 ---------------------------------------------- 1 file changed, 77 deletions(-) (limited to 'tests/GrMemoryPoolTest.cpp') diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp index 3df4078db2..bdc5557510 100644 --- a/tests/GrMemoryPoolTest.cpp +++ b/tests/GrMemoryPoolTest.cpp @@ -318,80 +318,3 @@ DEF_TEST(GrMemoryPoolAPI, reporter) { REPORTER_ASSERT(reporter, pool.size() == hugeBlockSize + kMinAllocSize); } } - -DEF_TEST(GrObjectMemoryPoolAPI, reporter) { - struct Data { - int value[5]; - }; - using DataObjectPool = GrObjectMemoryPool; - constexpr size_t kSmallestMinAllocCount = DataObjectPool::kSmallestMinAllocCount; - - // Allocates objects until pool adds a new block (pool.size() changes). - // Returns number of objects that fit into the current block (i.e. before pool.size() - // changed; newly allocated block always ends up with one object allocated from it). - auto allocateObjects = [](DataObjectPool& pool, AutoPoolReleaser& r) -> size_t { - size_t count = 0; - size_t origPoolSize = pool.size(); - while (pool.size() == origPoolSize) { - r.add(pool.allocate()); - count++; - } - return count - 1; - }; - - // Effective prealloc space capacity is >= kSmallestMinAllocCount. - { - DataObjectPool pool(kSmallestMinAllocCount / 3, 0); - AutoPoolReleaser r(pool); - - size_t preallocCount = allocateObjects(pool, r); - REPORTER_ASSERT(reporter, preallocCount == kSmallestMinAllocCount); - } - - // Effective prealloc space capacity is >= minAllocCount. - { - DataObjectPool pool(kSmallestMinAllocCount, 2 * kSmallestMinAllocCount); - AutoPoolReleaser r(pool); - - size_t preallocCount = allocateObjects(pool, r); - REPORTER_ASSERT(reporter, preallocCount == 2 * kSmallestMinAllocCount); - } - - // Effective block capacity is >= kSmallestMinAllocCount. - { - DataObjectPool pool(kSmallestMinAllocCount, kSmallestMinAllocCount / 2); - AutoPoolReleaser r(pool); - - // Fill prealloc space - allocateObjects(pool, r); - - size_t minAllocCount = 1 + allocateObjects(pool, r); - REPORTER_ASSERT(reporter, minAllocCount == kSmallestMinAllocCount); - } - - // Pool allocates space for exactly preallocCount objects on creation. - { - constexpr size_t kPreallocCount = kSmallestMinAllocCount * 7 / 3; - DataObjectPool pool(kPreallocCount, 0); - AutoPoolReleaser r(pool); - - size_t preallocCount = allocateObjects(pool, r); - REPORTER_ASSERT(reporter, preallocCount == kPreallocCount); - } - - // Pool allocates space for minAllocCount objects when it adds a new block. - { - constexpr size_t kMinAllocCount = kSmallestMinAllocCount * 11 / 3; - DataObjectPool pool(0, kMinAllocCount); - AutoPoolReleaser r(pool); - - // Fill prealloc space - allocateObjects(pool, r); - - size_t firstBlockCount = 1 + allocateObjects(pool, r); - REPORTER_ASSERT(reporter, firstBlockCount == kMinAllocCount); - - size_t secondBlockCount = 1 + allocateObjects(pool, r); - REPORTER_ASSERT(reporter, secondBlockCount == kMinAllocCount); - } -} -- cgit v1.2.3