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 /filter/source | |
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 'filter/source')
-rw-r--r-- | filter/source/config/cache/filterfactory.cxx | 20 | ||||
-rw-r--r-- | filter/source/config/cache/filterfactory.hxx | 4 |
2 files changed, 6 insertions, 18 deletions
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 6bcb0cc4e326..c22e3bb03830 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -406,15 +406,9 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz } -std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const +std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() { - // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aMutex); - css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aLock.clear(); - // <- SAFE ---------------------- - - css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(xContext); + css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(); std::vector<OUString> lModules(comphelper::sequenceToContainer< std::vector<OUString> >(xModuleConfig->getElementNames())); return lModules; } @@ -469,17 +463,11 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS } -std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const +std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) { - // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aMutex); - css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aLock.clear(); - // <- SAFE ---------------------- - try { - css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get(xContext); + css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get(); // don't check the module name here. If it does not exists, an exception is thrown and caught below. // We return an empty list as result then. css::uno::Reference< css::container::XNameAccess > xModule; diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx index 19abea5d6db0..f4c161df2914 100644 --- a/filter/source/config/cache/filterfactory.hxx +++ b/filter/source/config/cache/filterfactory.hxx @@ -95,7 +95,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer /** TODO document me */ - std::vector<OUString> impl_getListOfInstalledModules() const; + static std::vector<OUString> impl_getListOfInstalledModules(); /** @short implement the container string query: @@ -126,7 +126,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer @return A string list of internal filter names. Can be empty. */ - std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule) const; + static std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule); }; |