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 /comphelper | |
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 'comphelper')
-rw-r--r-- | comphelper/source/misc/configuration.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx index 67009cd9f864..46ac8ab6c407 100644 --- a/comphelper/source/misc/configuration.cxx +++ b/comphelper/source/misc/configuration.cxx @@ -38,9 +38,9 @@ namespace com::sun::star::uno { class XComponentContext; } namespace { -comphelper::detail::ConfigurationWrapper& GetTheConfigurationWrapper(const css::uno::Reference< css::uno::XComponentContext >& xContext) +comphelper::detail::ConfigurationWrapper& GetTheConfigurationWrapper() { - static comphelper::detail::ConfigurationWrapper WRAPPER(xContext); + static comphelper::detail::ConfigurationWrapper WRAPPER(comphelper::getProcessComponentContext()); return WRAPPER; } @@ -67,10 +67,9 @@ OUString extendLocalizedPath(std::u16string_view path, OUString const & locale) } std::shared_ptr< comphelper::ConfigurationChanges > -comphelper::ConfigurationChanges::create( - css::uno::Reference< css::uno::XComponentContext > const & context) +comphelper::ConfigurationChanges::create() { - return GetTheConfigurationWrapper(context).createChanges(); + return GetTheConfigurationWrapper().createChanges(); } comphelper::ConfigurationChanges::~ConfigurationChanges() {} @@ -107,10 +106,9 @@ comphelper::ConfigurationChanges::getSet(OUString const & path) const } comphelper::detail::ConfigurationWrapper const & -comphelper::detail::ConfigurationWrapper::get( - css::uno::Reference< css::uno::XComponentContext > const & context) +comphelper::detail::ConfigurationWrapper::get() { - return GetTheConfigurationWrapper(context); + return GetTheConfigurationWrapper(); } comphelper::detail::ConfigurationWrapper::ConfigurationWrapper( |