summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h4
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx17
-rw-r--r--include/vcl/lok.hxx4
3 files changed, 25 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 3887d3d3c412..e98ea6f47f42 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -127,6 +127,10 @@ struct _LibreOfficeKitClass
*/
char* (*extractRequest) (LibreOfficeKit* pThis,
const char* pFilePath);
+
+ /// @see lok::Office::trimMemory
+ /// @since LibreOffice 7.6
+ void (*trimMemory) (LibreOfficeKit* pThis, int nTarget);
};
#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index d3c2e5de78aa..bc3bbb98cc10 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -1146,6 +1146,23 @@ public:
{
return mpThis->pClass->extractRequest(mpThis, pFilePath);
}
+
+ /**
+ * Trim memory usage.
+ *
+ * LibreOfficeKit caches lots of information from large pixmaps
+ * to view and calculation results. When a view has not been
+ * used for some time, depending on the load on memory it can
+ * be useful to free up memory.
+ *
+ * @param nTarget - a negative number means the app is back
+ * in active use, and to re-fill caches, a large positive
+ * number (>=1000) encourages immediate maximum memory saving.
+ */
+ void trimMemory (int nTarget)
+ {
+ mpThis->pClass->trimMemory(mpThis, nTarget);
+ }
};
/// Factory method to create a lok::Office instance.
diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx
index 31a4cf1ec494..ea7ffadd437b 100644
--- a/include/vcl/lok.hxx
+++ b/include/vcl/lok.hxx
@@ -26,6 +26,10 @@ void VCL_DLLPUBLIC unregisterPollCallbacks();
// can adjust e.g. sizes of bitmap caches to scale well with larger number of users.
void VCL_DLLPUBLIC numberOfViewsChanged(int count);
+// Trim memory use by wiping various internal caches
+void VCL_DLLPUBLIC trimMemory(int nTarget);
+
+// Dump internal state of VCL windows etc. for debugging
void VCL_DLLPUBLIC dumpState(rtl::OStringBuffer& rState);
}