aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-07 11:14:39 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-07 16:08:41 +0000
commit9519d4f05a211c2d4a52ad1dacfe59ceeb884adb (patch)
tree653df89fcbabe994e506a015622ca4f5c7a2158f /src
parent0e6cd9ec988193e51f89f9f5477db7475b0b3838 (diff)
Remove unused GrObjectMemoryPool
Change-Id: I8d37dfa3a5f0af4741eb6f1c10e13065d20b0ccb Reviewed-on: https://skia-review.googlesource.com/132829 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrMemoryPool.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/gpu/GrMemoryPool.h b/src/gpu/GrMemoryPool.h
index 26a763430f..825b83a1ab 100644
--- a/src/gpu/GrMemoryPool.h
+++ b/src/gpu/GrMemoryPool.h
@@ -121,69 +121,4 @@ protected:
};
};
-/**
- * Variant of GrMemoryPool that can only allocate objects of a single type. It is
- * not as flexible as GrMemoryPool, but it has more convenient allocate() method,
- * and more importantly, it guarantees number of objects that are preallocated at
- * construction or when adding a new memory block. I.e.
- *
- * GrMemoryPool pool(3 * sizeof(T), 1000 * sizeof(T));
- * pool.allocate(sizeof(T));
- * pool.allocate(sizeof(T));
- * pool.allocate(sizeof(T));
- *
- * will preallocate 3 * sizeof(T) bytes and use some of those bytes for internal
- * structures. Because of that, last allocate() call will end up allocating a new
- * block of 1000 * sizeof(T) bytes. In contrast,
- *
- * GrObjectMemoryPool<T> pool(3, 1000);
- * pool.allocate();
- * pool.allocate();
- * pool.allocate();
- *
- * guarantees to preallocate enough memory for 3 objects of sizeof(T), so last
- * allocate() will use preallocated memory and won't cause allocation of a new block.
- *
- * Same thing is true for the second (minAlloc) ctor argument: this class guarantees
- * that a newly added block will have enough space for 1000 objects of sizeof(T), while
- * GrMemoryPool does not.
- */
-template <class T>
-class GrObjectMemoryPool: public GrMemoryPool {
-public:
- /**
- * Preallocates memory for preallocCount objects, and sets new block size to be
- * enough to hold minAllocCount objects.
- */
- GrObjectMemoryPool(size_t preallocCount, size_t minAllocCount)
- : GrMemoryPool(CountToSize(preallocCount),
- CountToSize(SkTMax(minAllocCount, kSmallestMinAllocCount))) {
- }
-
- /**
- * Allocates memory for an object, but doesn't construct or otherwise initialize it.
- * The memory must be freed with release().
- */
- T* allocate() { return static_cast<T*>(GrMemoryPool::allocate(sizeof(T))); }
-
-private:
- constexpr static size_t kTotalObjectSize =
- kPerAllocPad + GR_CT_ALIGN_UP(sizeof(T), kAlignment);
-
- constexpr static size_t CountToSize(size_t count) {
- return kHeaderSize + count * kTotalObjectSize;
- }
-
-public:
- /**
- * Minimum value of minAllocCount constructor argument.
- */
- constexpr static size_t kSmallestMinAllocCount =
- (GrMemoryPool::kSmallestMinAllocSize - kHeaderSize + kTotalObjectSize - 1) /
- kTotalObjectSize;
-};
-
-template <class T>
-constexpr size_t GrObjectMemoryPool<T>::kSmallestMinAllocCount;
-
#endif