diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-03-05 11:23:38 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-03-07 15:37:22 +0100 |
commit | 4256c764aee0777770466115a97420d9b55c23ac (patch) | |
tree | 9452b0dc5c84355826d070ad3eccba498ef9c5e8 /sw/qa | |
parent | 58c6a36bfcc853ca9da81fbc2d071fa50585655b (diff) |
do not pass XComponentContext to officecfg::...::get() calls
It's used only for the ConfigurationWrapper singleton, so it's used
only the first time and then ignored. It also causes calls to
comphelper::getProcessComponentContext() for every single invocation
despite the value not being needed, and the calls may not be cheap
(it's ~5% CPU during ODS save because relatively frequent calls
to officecfg::Office::Common::Save::ODF::DefaultVersion::get()).
Change-Id: I02c17a1a9cb498aeef220ddd5a0bde5523cb0ffb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131056
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter4.cxx | 12 |
2 files changed, 4 insertions, 11 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 90e9d9f9902b..0fe486ee2232 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3350,10 +3350,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf90362) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf90362.fodt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext()); // Ensure correct initial setting std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create(xComponentContext)); + comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch); batch->commit(); // First check if the end of the second paragraph is indeed protected. diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index de93fd2e8125..c18216eed770 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -1747,11 +1747,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105625) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf105625.fodt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - uno::Reference<uno::XComponentContext> xComponentContext( - comphelper::getProcessComponentContext()); // Ensure correct initial setting std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create(xComponentContext)); + comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch); batch->commit(); // We should be able to edit at positions adjacent to fields. @@ -1783,11 +1781,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protected) // so read-only is already true when fieldmarks are considered. SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125151_protected.fodt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - uno::Reference<uno::XComponentContext> xComponentContext( - comphelper::getProcessComponentContext()); // Ensure correct initial setting std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create(xComponentContext)); + comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch); batch->commit(); pWrtShell->Down(/*bSelect=*/false); @@ -1803,11 +1799,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protectedB) // Similar to testTdf105625 except this is protected with the Protect_Form compat setting SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125151_protectedB.fodt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - uno::Reference<uno::XComponentContext> xComponentContext( - comphelper::getProcessComponentContext()); // Ensure correct initial setting std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create(xComponentContext)); + comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch); batch->commit(); // The cursor starts inside of the FieldMark textbox. |