From f6e989709cef935027ae5b822328004527ff3711 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 2 Jul 2015 12:20:33 +0200 Subject: 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 --- src/core/resources/qframeallocator.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/core/resources/qframeallocator.cpp') 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 -- cgit v1.2.3