diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-09-06 13:39:48 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-09-11 07:33:59 +0000 |
commit | 64d018ea11e00174cedabda9230a93054b40d79b (patch) | |
tree | c0be12e3d995ec2b7fbb355016fbfcdef8351986 /src | |
parent | cf038f9059d88271c087b958f04a10e6f468c249 (diff) |
Remove ArrayPreallocationPolicy
It's not used anywhere
Change-Id: Id65ec9fc8e38697c0dbd23fe4f816e1637a22483
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/resources/qresourcemanager_p.h | 55 |
1 files changed, 1 insertions, 54 deletions
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 <typename T, uint INDEXBITS> +template <typename T, uint INDEXBITS = 16> class ArrayAllocatingPolicy { public: @@ -331,59 +331,6 @@ private: }; -template <typename T, uint INDEXBITS> -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<QResourceInfo<T>::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<T> m_bucket; - QVector<int> m_freeList; - - void performCleanup(T *r, Int2Type<true>) - { - r->cleanup(); - } - - void performCleanup(T *, Int2Type<false>) - {} - -}; - #ifndef QT_NO_DEBUG_STREAM template <typename ValueType, typename KeyType, uint INDEXBITS, template <typename, uint> class AllocatingPolicy, |