diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2024-05-18 22:08:22 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2024-07-26 13:37:26 +0200 |
commit | f9df8d71a9d4ad2e7bc2e221551d9ee007f9fc60 (patch) | |
tree | 943172c401e9f870940be6cf47d4a00e7ef50371 /desktop | |
parent | dbfa56584cac08cae733513c13803a9c6ece22f6 (diff) |
lok: join Webdav Ticker thread.
Add 'startThreads' lok method for the few thread scenarios where
we need to have a background thread running that cannot be started
opportunistically.
Also add that to the ThreadJoinable interface so we can get into
UNO components' implementations to handle their worker threads
easily.
Implement joining and re-starting in WebDAV ucp too.
Change-Id: I329ef9decb32b263197e4c03a0d54952985fdd0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167858
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170979
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 7 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 18 |
2 files changed, 22 insertions, 3 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index c5d981ca6c58..3636b8cd9df0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3589,12 +3589,13 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(classOffset(18), offsetof(struct _LibreOfficeKitClass, startURP)); CPPUNIT_ASSERT_EQUAL(classOffset(19), offsetof(struct _LibreOfficeKitClass, stopURP)); CPPUNIT_ASSERT_EQUAL(classOffset(20), offsetof(struct _LibreOfficeKitClass, joinThreads)); - CPPUNIT_ASSERT_EQUAL(classOffset(21), offsetof(struct _LibreOfficeKitClass, setForkedChild)); - CPPUNIT_ASSERT_EQUAL(classOffset(22), offsetof(struct _LibreOfficeKitClass, extractDocumentStructureRequest)); + CPPUNIT_ASSERT_EQUAL(classOffset(21), offsetof(struct _LibreOfficeKitClass, startThreads)); + CPPUNIT_ASSERT_EQUAL(classOffset(22), offsetof(struct _LibreOfficeKitClass, setForkedChild)); + CPPUNIT_ASSERT_EQUAL(classOffset(23), offsetof(struct _LibreOfficeKitClass, extractDocumentStructureRequest)); // When extending LibreOfficeKit with a new function pointer, add new assert for the offsetof the // new function pointer and bump this assert for the size of the class. - CPPUNIT_ASSERT_EQUAL(classOffset(23), sizeof(struct _LibreOfficeKitClass)); + CPPUNIT_ASSERT_EQUAL(classOffset(24), sizeof(struct _LibreOfficeKitClass)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7d4b9d5041f6..442d88eaeecf 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2575,6 +2575,8 @@ static void lo_stopURP(LibreOfficeKit* pThis, void* pSendURPToLOContext); static int lo_joinThreads(LibreOfficeKit* pThis); +static void lo_startThreads(LibreOfficeKit* pThis); + static void lo_setForkedChild(LibreOfficeKit* pThis, bool bIsChild); static void lo_runLoop(LibreOfficeKit* pThis, @@ -2625,6 +2627,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl() m_pOfficeClass->startURP = lo_startURP; m_pOfficeClass->stopURP = lo_stopURP; m_pOfficeClass->joinThreads = lo_joinThreads; + m_pOfficeClass->startThreads = lo_startThreads; m_pOfficeClass->setForkedChild = lo_setForkedChild; m_pOfficeClass->extractDocumentStructureRequest = lo_extractDocumentStructureRequest; @@ -3443,6 +3446,12 @@ static int lo_joinThreads(LibreOfficeKit* /* pThis */) if (joinable && !joinable->joinThreads()) return 0; + auto ucpWebdav = xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.ucb.WebDAVManager", xContext); + joinable = dynamic_cast<comphelper::LibreOfficeKit::ThreadJoinable *>(ucpWebdav.get()); + if (joinable && !joinable->joinThreads()) + return 0; + // Ensure configmgr's write thread is down css::uno::Reference< css::util::XFlushable >( css::configuration::theDefaultProvider::get( @@ -3452,6 +3461,15 @@ static int lo_joinThreads(LibreOfficeKit* /* pThis */) return 1; } +static void lo_startThreads(LibreOfficeKit* /* pThis */) +{ + auto ucpWebdav = xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.ucb.WebDAVManager", xContext); + auto joinable = dynamic_cast<comphelper::LibreOfficeKit::ThreadJoinable *>(ucpWebdav.get()); + if (joinable) + joinable->startThreads(); +} + static void lo_setForkedChild(LibreOfficeKit* /* pThis */, bool bIsChild) { comphelper::LibreOfficeKit::setForkedChild(bIsChild); |