summaryrefslogtreecommitdiff
path: root/vcl/source/graphic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-06-19 22:28:20 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-06-20 07:50:19 +0200
commit9376f65a26240441bf9dd6ae1f69886dc9fa60fa (patch)
tree4971b86c35daa36f0fd913c61303f11320e01b4c /vcl/source/graphic
parent8ae297fde961abcba627d62936efdbb5c6fe03d3 (diff)
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
...where scoped_lock was originally meant as a transparent generalization of lock_guard, but eventually had to supersede it under a new name, for backwards- compatibility reasons, see <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0156r2.html> "Variadic lock_guard (Rev. 5)" and <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0488r0.pdf> "WG21 Working Paper, NB Comments, ISO/IEC CD 14882". Change-Id: Ie58909f63beec5939601183d6bcda3bc638d5747 Reviewed-on: https://gerrit.libreoffice.org/74382 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source/graphic')
-rw-r--r--vcl/source/graphic/Manager.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 7a03f85468dd..3ddec0ae280b 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -76,7 +76,7 @@ Manager::Manager()
void Manager::reduceGraphicMemory()
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
{
@@ -108,7 +108,7 @@ sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)
IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
pTimer->Stop();
reduceGraphicMemory();
@@ -118,7 +118,7 @@ IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
OUString const& /*rsContext*/)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
// make some space first
if (mnUsedSize > mnMemoryLimit)
@@ -149,7 +149,7 @@ void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
void Manager::unregisterGraphic(ImpGraphic* pImpGraphic)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize -= getGraphicSizeBytes(pImpGraphic);
m_pImpGraphicList.erase(pImpGraphic);
@@ -213,21 +213,21 @@ std::shared_ptr<ImpGraphic> Manager::newInstance(const GraphicExternalLink& rGra
void Manager::swappedIn(const ImpGraphic* pImpGraphic)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize += getGraphicSizeBytes(pImpGraphic);
}
void Manager::swappedOut(const ImpGraphic* pImpGraphic)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize -= getGraphicSizeBytes(pImpGraphic);
}
void Manager::changeExisting(const ImpGraphic* pImpGraphic, sal_Int64 nOldSizeBytes)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize -= nOldSizeBytes;
mnUsedSize += getGraphicSizeBytes(pImpGraphic);