summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/resources/qresourcemanager_p.h55
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,