summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-10-15 08:43:23 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-10-24 01:40:45 +0200
commit273a25c796fca9afa0dfadac57dc3f336831221c (patch)
tree3efb1e505e27164bcdb2c164c59a48c814221ffe /sd
parent667c2499d861cfcd26935fc0512cb5aaf602c4c5 (diff)
change some LOK internal updates to be pull model instead of push
Some LOK messages may get called very often, such as updates about cursor position. And since only the last one matters, they get generated every time, which costs some time, and then later except for one they get all discard again from CallbackFlushHandler queue, which again costs time. Change the model to instead only set an 'updated' flag, and CallbackFlushHandler will request the actual message payload only before flushing. This commit changes LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR and LOK_CALLBACK_INVALIDATE_VIEW_CURSOR to work this way. Change-Id: I376be63176c0b4b5cb492fbf529c21ed01b35481 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124083 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index e2a0e8a46501..ea7bfc5c11bb 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -203,6 +203,7 @@ public:
private:
SdXImpressDocument* createDoc(const char* pName, const uno::Sequence<beans::PropertyValue>& rArguments = uno::Sequence<beans::PropertyValue>());
+ void setupLibreOfficeKitViewCallback(SfxViewShell& pViewShell);
static void callback(int nType, const char* pPayload, void* pData);
void callbackImpl(int nType, const char* pPayload);
xmlDocUniquePtr parseXmlDump();
@@ -252,6 +253,7 @@ void SdTiledRenderingTest::tearDown()
if (m_pXmlBuffer)
xmlBufferFree(m_pXmlBuffer);
+ m_callbackWrapper.clear();
comphelper::LibreOfficeKit::setActive(false);
test::BootstrapFixture::tearDown();
@@ -268,6 +270,12 @@ SdXImpressDocument* SdTiledRenderingTest::createDoc(const char* pName, const uno
return pImpressDocument;
}
+void SdTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell& pViewShell)
+{
+ pViewShell.setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(&pViewShell));
+}
+
void SdTiledRenderingTest::callback(int nType, const char* pPayload, void* pData)
{
static_cast<SdTiledRenderingTest*>(pData)->callbackImpl(nType, pPayload);
@@ -404,7 +412,7 @@ void SdTiledRenderingTest::testRegisterCallback()
{
SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
- pViewShell->GetViewShellBase().setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase());
// Start text edit of the empty title shape.
SdPage* pActualPage = pViewShell->GetActualPage();
@@ -634,7 +642,7 @@ void SdTiledRenderingTest::testInsertDeletePage()
{
SdXImpressDocument* pXImpressDocument = createDoc("insert-delete.odp");
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
- pViewShell->GetViewShellBase().setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase());
SdDrawDocument* pDoc = pXImpressDocument->GetDocShell()->GetDoc();
CPPUNIT_ASSERT(pDoc);
@@ -921,6 +929,7 @@ public:
mpViewShell = SfxViewShell::Current();
mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
mnView = SfxLokHelper::getView();
+ m_callbackWrapper.setLOKViewId( mnView );
}
~ViewCallback()
@@ -2534,7 +2543,7 @@ void SdTiledRenderingTest::testCutSelectionChange()
CPPUNIT_ASSERT(pXImpressDocument);
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
- pViewShell->GetViewShellBase().setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ setupLibreOfficeKitViewCallback(pViewShell->GetViewShellBase());
Scheduler::ProcessEventsToIdle();
// Select first text object