From 64d018ea11e00174cedabda9230a93054b40d79b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 6 Sep 2017 13:39:48 +0200 Subject: Remove ArrayPreallocationPolicy It's not used anywhere Change-Id: Id65ec9fc8e38697c0dbd23fe4f816e1637a22483 Reviewed-by: Sean Harmer --- src/core/resources/qresourcemanager_p.h | 55 +-------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'src') diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h index 8ddc1c0a4..0d8cdffbf 100644 --- a/src/core/resources/qresourcemanager_p.h +++ b/src/core/resources/qresourcemanager_p.h @@ -220,7 +220,7 @@ struct Int2Type }; }; -template +template class ArrayAllocatingPolicy { public: @@ -331,59 +331,6 @@ private: }; -template -class ArrayPreallocationPolicy -{ -public: - ArrayPreallocationPolicy() - { - reset(); - } - - T* allocateResource() - { - Q_ASSERT(!m_freeList.isEmpty()); - int idx = m_freeList.last(); - m_freeList.pop_back(); - return m_bucket.data() + idx; - } - - void releaseResource(T *r) - { - Q_ASSERT(m_bucket.data() <= r && r < m_bucket.data() + MaxSize); - int idx = r - m_bucket.data(); - m_freeList.append(idx); - performCleanup(r, Int2Type::needsCleanup>()); - *r = T(); - } - - void reset() - { - m_bucket.clear(); - m_bucket.resize(MaxSize); - m_freeList.resize(MaxSize); - for (int i = 0; i < MaxSize; i++) - m_freeList[i] = MaxSize - (i + 1); - } - -private: - enum { - MaxSize = 1 << INDEXBITS - }; - - QVector m_bucket; - QVector m_freeList; - - void performCleanup(T *r, Int2Type) - { - r->cleanup(); - } - - void performCleanup(T *, Int2Type) - {} - -}; - #ifndef QT_NO_DEBUG_STREAM template class AllocatingPolicy, -- cgit v1.2.3