From a93220b79faad8d679f3c67ccd967cdfac68d49f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 7 May 2022 09:18:27 +0200 Subject: [PATCH] osl::Mutex->std::mutex in VDevBuffer Change-Id: I64b48e60f178574a0e0382e72a002a87320bbf39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133972 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/processor2d/vclhelperbufferdevice.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 24e0c6a30bcb..c19dd965755a 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -30,16 +30,16 @@ #include #include #include -#include #include #include #include +#include // buffered VDev usage namespace { -class VDevBuffer : public Timer, protected cppu::BaseMutex +class VDevBuffer : public Timer { private: struct Entry @@ -53,6 +53,8 @@ private: } }; + std::mutex m_aMutex; + // available buffers std::vector maFreeBuffers; @@ -85,7 +87,7 @@ VDevBuffer::VDevBuffer() VDevBuffer::~VDevBuffer() { - ::osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); Stop(); while (!maFreeBuffers.empty()) @@ -132,7 +134,7 @@ bool VDevBuffer::isSizeSuitable(const VclPtr& device, const Size& VclPtr VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bTransparent) { - ::osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); VclPtr pRetval; sal_Int32 nBits = rOutDev.GetBitCount(); @@ -248,7 +250,7 @@ VclPtr VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSize void VDevBuffer::free(VirtualDevice& rDevice) { - ::osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); const auto aUsedFound = std::find_if(maUsedBuffers.begin(), maUsedBuffers.end(), [&rDevice](const Entry& el) { return el.buf == &rDevice; }); @@ -266,7 +268,7 @@ void VDevBuffer::free(VirtualDevice& rDevice) void VDevBuffer::Invoke() { - ::osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); while (!maFreeBuffers.empty()) {