summaryrefslogtreecommitdiffstats
path: root/src/core/resources/qframeallocator.cpp
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/resources/qframeallocator.cpp
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/resources/qframeallocator.cpp')
-rw-r--r--src/core/resources/qframeallocator.cpp19
1 files changed, 19 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