summaryrefslogtreecommitdiff
path: root/sc/qa
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 /sc/qa
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 'sc/qa')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 351f1f12644f..d8aef459e4d5 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -179,6 +179,7 @@ public:
private:
ScModelObj* createDoc(const char* pName);
+ void setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell);
static void callback(int nType, const char* pPayload, void* pData);
void callbackImpl(int nType, const char* pPayload);
@@ -220,6 +221,7 @@ void ScTiledRenderingTest::tearDown()
}
mxComponent->dispose();
}
+ m_callbackWrapper.clear();
comphelper::LibreOfficeKit::setActive(false);
test::BootstrapFixture::tearDown();
@@ -236,6 +238,12 @@ ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)
return pModelObj;
}
+void ScTiledRenderingTest::setupLibreOfficeKitViewCallback(SfxViewShell* pViewShell)
+{
+ pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ m_callbackWrapper.setLOKViewId(SfxLokHelper::getView(pViewShell));
+}
+
void ScTiledRenderingTest::callback(int nType, const char* pPayload, void* pData)
{
static_cast<ScTiledRenderingTest*>(pData)->callbackImpl(nType, pPayload);
@@ -398,7 +406,7 @@ void ScTiledRenderingTest::testDocumentSize()
ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
CPPUNIT_ASSERT(pViewShell);
- pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ setupLibreOfficeKitViewCallback(pViewShell);
// check initial document size
Size aDocSize = pModelObj->getDocumentSize();
@@ -598,6 +606,7 @@ public:
mpViewShell = SfxViewShell::Current();
mpViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
mnView = SfxLokHelper::getView();
+ m_callbackWrapper.setLOKViewId( mnView );
if (!bDeleteListenerOnDestruct)
mpViewShell = nullptr;
}
@@ -781,7 +790,7 @@ void ScTiledRenderingTest::testDocumentSizeChanged()
// Load a document that doesn't have much content.
createDoc("small.ods");
- SfxViewShell::Current()->setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ setupLibreOfficeKitViewCallback(SfxViewShell::Current());
// Go to the A30 cell -- that will extend the document size.
uno::Sequence<beans::PropertyValue> aPropertyValues =
@@ -883,7 +892,7 @@ void ScTiledRenderingTest::testColRowResize()
ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
CPPUNIT_ASSERT(pViewShell);
- pViewShell->setLibreOfficeKitViewCallback(&m_callbackWrapper);
+ setupLibreOfficeKitViewCallback(pViewShell);
ScDocument& rDoc = pDocSh->GetDocument();