summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2024-03-27 17:25:24 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-28 12:29:41 +0100
commit9dab5edb90d14ad6f71cc2ac96cc504c1e8c290b (patch)
treeebea3732602244d31e445ac2b57fc48f35c9ea6e /include
parent96bbedb1585f7cda6faab0aa8cba1ac2217be212 (diff)
lok: add isForkedChild method.
This can be used to tag short-lived transient 'save' processes to encourage them not to mutate eg. filesystem state that is shared with the parent process. Change-Id: I027d18cbe4ce519b31c4fc1d3ac46b916d1efc87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165407 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h3
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx9
-rw-r--r--include/comphelper/lok.hxx6
3 files changed, 18 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 450366ccb70c..f57c7ad32843 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -143,6 +143,9 @@ struct _LibreOfficeKitClass
/// @see lok::Office::joinThreads
int (*joinThreads)(LibreOfficeKit* pThis);
+
+ /// @see lok::Office::setForkedChild
+ void (*setForkedChild)(LibreOfficeKit* pThis, bool bIsChild);
};
#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 8b7a211804be..af9ccd12ab2f 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -1222,6 +1222,15 @@ public:
{
return mpThis->pClass->joinThreads(mpThis);
}
+
+ /**
+ * Informs that this process is either a parent, or a child
+ * process post-fork, allowing improved resource sharing.
+ */
+ void setForkedChild(bool bIsChild)
+ {
+ return mpThis->pClass->setForkedChild(mpThis, bIsChild);
+ }
};
/// Factory method to create a lok::Office instance.
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 4ca03f049225..555b749fa6a1 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -33,6 +33,8 @@ public:
COMPHELPER_DLLPUBLIC void setActive(bool bActive = true);
+COMPHELPER_DLLPUBLIC void setForkedChild(bool bIsChild = true);
+
enum class statusIndicatorCallbackType
{
Start,
@@ -49,6 +51,10 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(
// Check whether the code is running as invoked through LibreOfficeKit.
COMPHELPER_DLLPUBLIC bool isActive();
+/// Is this a transient forked child process, that shares many
+/// eg. file-system resources with its parent process?
+COMPHELPER_DLLPUBLIC bool isForkedChild();
+
/// Shift the coordinates before rendering each bitmap.
/// Used by Calc to render each tile separately.
/// This should be unnecessary (and removed) once Calc