summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-07-02 12:20:33 +0200
committerPaul Lemire <paul.lemire@kdab.com>2015-07-02 20:11:13 +0000
commitf6e989709cef935027ae5b822328004527ff3711 (patch)
tree1c3a645ff8ce5627071fb0724b9601d049da7ee5 /src/core
parent01e371dfaff7697456cf91d32d017ee994ba50f9 (diff)
QFrameAllocator add a new isEmpty method
+ Unit tests Will help making sure everything is properly deleted after submitting the RenderViews. Change-Id: I097e02b095ad6ffd02db07a406a33982a794b7eb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/resources/qframeallocator.cpp19
-rw-r--r--src/core/resources/qframeallocator.h1
-rw-r--r--src/core/resources/qframeallocator_p.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/src/core/resources/qframeallocator.cpp b/src/core/resources/qframeallocator.cpp
index c62e7ad0d..3e83e29bf 100644
--- a/src/core/resources/qframeallocator.cpp
+++ b/src/core/resources/qframeallocator.cpp
@@ -104,6 +104,16 @@ int QFrameAllocator::allocatorPoolSize() const
return d->m_allocatorPool.size();
}
+bool QFrameAllocator::isEmpty() const
+{
+ Q_D(const QFrameAllocator);
+ Q_FOREACH (const QFixedFrameAllocator &allocator, d->m_allocatorPool) {
+ if (!allocator.isEmpty())
+ return false;
+ }
+ return true;
+}
+
uint QFrameAllocator::totalChunkCount() const
{
Q_D(const QFrameAllocator);
@@ -203,6 +213,15 @@ void QFixedFrameAllocator::clear()
m_chunks[i].clear(m_blockSize, m_nbrBlock);
}
+bool QFixedFrameAllocator::isEmpty() const
+{
+ Q_FOREACH (const QFrameChunk &chunck, m_chunks) {
+ if (chunck.m_blocksAvailable != chunck.m_maxBlocksAvailable)
+ return false;
+ }
+ return true;
+}
+
// QFrameChuck is agnostic about blocksize
// However if it was initialized with a block size of 16
// You should then pass 16 to allocate and deallocate
diff --git a/src/core/resources/qframeallocator.h b/src/core/resources/qframeallocator.h
index 91c8c1c5f..4fab92e91 100644
--- a/src/core/resources/qframeallocator.h
+++ b/src/core/resources/qframeallocator.h
@@ -84,6 +84,7 @@ public:
uint maxObjectSize() const;
uint totalChunkCount() const;
int allocatorPoolSize() const;
+ bool isEmpty() const;
private:
Q_DECLARE_PRIVATE(QFrameAllocator)
diff --git a/src/core/resources/qframeallocator_p.h b/src/core/resources/qframeallocator_p.h
index 990066138..471691e8e 100644
--- a/src/core/resources/qframeallocator_p.h
+++ b/src/core/resources/qframeallocator_p.h
@@ -75,6 +75,7 @@ public:
void trim();
void release();
void clear();
+ bool isEmpty() const;
inline int chunkCount() const { return m_chunks.size(); }
inline uchar pageSize() const { return m_nbrBlock; }