summaryrefslogtreecommitdiff
path: root/vcl/source/app/svapp.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2023-03-10 10:36:22 +0000
committerMichael Meeks <michael.meeks@collabora.com>2023-03-11 21:03:05 +0000
commit4a4602ad7513262a6c0423f17b42791a852b7e23 (patch)
treeee6d2b88f488ad1b4ba0c8cbd6b392f4e8cbc440 /vcl/source/app/svapp.cxx
parent9dec458e40a8b6a180e5c1c6f93fd4277825b9a2 (diff)
lok: add trimMemory capability, and expand dumpState to caches.
Being able to trigger some more aggressive memory saving is useful in for both online and mobile. Change-Id: I9b91c9fe9eecec06c75112595deac0bfeb94c144 Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148624 Tested-by: Jenkins
Diffstat (limited to 'vcl/source/app/svapp.cxx')
-rw-r--r--vcl/source/app/svapp.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index f503310949f2..5359ac139532 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -54,6 +54,7 @@
#include <vcl/skia/SkiaHelper.hxx>
#include <salinst.hxx>
+#include <graphic/Manager.hxx>
#include <salframe.hxx>
#include <salsys.hxx>
#include <svdata.hxx>
@@ -69,6 +70,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/awt/XToolkit.hpp>
#include <comphelper/lok.hxx>
+#include <comphelper/threadpool.hxx>
#include <comphelper/solarmutex.hxx>
#include <osl/process.h>
@@ -1870,6 +1872,25 @@ void dumpState(rtl::OStringBuffer &rState)
pWin = Application::GetNextTopLevelWindow( pWin );
}
+
+ vcl::graphic::Manager::get().dumpState(rState);
+
+ pSVData->dumpState(rState);
+}
+
+void trimMemory(int nTarget)
+{
+ if (nTarget >= 1000)
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ if (!pSVData) // shutting down
+ return;
+ pSVData->dropCaches();
+ vcl::graphic::Manager::get().dropCache();
+ // TODO: ideally - free up any deeper dirtied thread stacks.
+ // comphelper::ThreadPool::getSharedOptimalPool().shutdown();
+ }
+ // else for now caches re-fill themselves as/when used.
}
} // namespace lok, namespace vcl