officecfg/registry/schema/org/openoffice/Office/Common.xcs | 8 +++++ vcl/inc/graphic/Manager.hxx | 1 vcl/source/graphic/Manager.cxx | 20 +++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-)
New commits: commit 4a5dc88ad3a8111f802d35f907d7352e53097fab Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Mon Oct 14 15:05:19 2019 +0200 Commit: Samuel Mehrbrodt <[email protected]> CommitDate: Tue Oct 15 08:57:26 2019 +0200 Add option to prevent graphic swap out Change-Id: Icbfc21b219cd4ba582e798e5deda6ef7c81a2009 Reviewed-on: https://gerrit.libreoffice.org/80773 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <[email protected]> (cherry picked from commit f0443fa4438aa98bce48bfd53dc6a687737687b6) Reviewed-on: https://gerrit.libreoffice.org/80806 Reviewed-by: Samuel Mehrbrodt <[email protected]> Tested-by: Samuel Mehrbrodt <[email protected]> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 543fd8c564a0..6162d467953f 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1524,6 +1524,14 @@ </info> <value>600</value> </prop> + <prop oor:name="GraphicSwappingEnabled" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Whether graphics will be swapped to disk when `GraphicMemoryLimit` + is reached. Disable at your own risk.</desc> + <label>Graphic Swapping Enabled</label> + </info> + <value>true</value> + </prop> <prop oor:name="GraphicMemoryLimit" oor:type="xs:int" oor:nillable="false"> <info> <desc>Specifies the allowed cumulated memory that the diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx index a756450caf28..f1413877bb08 100644 --- a/vcl/inc/graphic/Manager.hxx +++ b/vcl/inc/graphic/Manager.hxx @@ -35,6 +35,7 @@ private: std::recursive_mutex maMutex; // instead of SolarMutex because graphics can live past vcl main std::unordered_set<ImpGraphic*> m_pImpGraphicList; std::chrono::seconds mnAllowedIdleTime; + bool mbSwapEnabled; sal_Int64 mnMemoryLimit; sal_Int64 mnUsedSize; Timer maSwapOutTimer; diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx index ec2bdca9be0b..5942b5cb8784 100644 --- a/vcl/source/graphic/Manager.cxx +++ b/vcl/source/graphic/Manager.cxx @@ -33,7 +33,7 @@ namespace graphic namespace { void setupConfigurationValuesIfPossible(sal_Int64& rMemoryLimit, - std::chrono::seconds& rAllowedIdleTime) + std::chrono::seconds& rAllowedIdleTime, bool& bSwapEnabled) { if (utl::ConfigManager::IsFuzzing()) return; @@ -45,6 +45,7 @@ void setupConfigurationValuesIfPossible(sal_Int64& rMemoryLimit, rMemoryLimit = Cache::GraphicManager::GraphicMemoryLimit::get(); rAllowedIdleTime = std::chrono::seconds(Cache::GraphicManager::GraphicAllowedIdleTime::get()); + bSwapEnabled = Cache::GraphicManager::GraphicSwappingEnabled::get(); } catch (...) { @@ -60,20 +61,27 @@ Manager& Manager::get() Manager::Manager() : mnAllowedIdleTime(10) + , mbSwapEnabled(true) , mnMemoryLimit(300000000) , mnUsedSize(0) , maSwapOutTimer("graphic::Manager maSwapOutTimer") { - setupConfigurationValuesIfPossible(mnMemoryLimit, mnAllowedIdleTime); + setupConfigurationValuesIfPossible(mnMemoryLimit, mnAllowedIdleTime, mbSwapEnabled); - maSwapOutTimer.SetInvokeHandler(LINK(this, Manager, SwapOutTimerHandler)); - maSwapOutTimer.SetTimeout(10000); - maSwapOutTimer.SetDebugName("graphic::Manager maSwapOutTimer"); - maSwapOutTimer.Start(); + if (mbSwapEnabled) + { + maSwapOutTimer.SetInvokeHandler(LINK(this, Manager, SwapOutTimerHandler)); + maSwapOutTimer.SetTimeout(10000); + maSwapOutTimer.SetDebugName("graphic::Manager maSwapOutTimer"); + maSwapOutTimer.Start(); + } } void Manager::reduceGraphicMemory() { + if (!mbSwapEnabled) + return; + std::scoped_lock<std::recursive_mutex> aGuard(maMutex); for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
