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 /extensions/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 'extensions/source')
-rw-r--r-- | extensions/source/config/WinUserInfo/WinUserInfoBe.cxx | 22 | ||||
-rw-r--r-- | extensions/source/config/WinUserInfo/WinUserInfoBe.hxx | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx index e62068f17b04..2e97ab5581ac 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx @@ -84,7 +84,7 @@ constexpr OUStringLiteral mail(u"mail"); class ADsUserAccess : public extensions::config::WinUserInfo::WinUserInfoBe_Impl { public: - ADsUserAccess(const css::uno::Reference<css::uno::XComponentContext>& xContext) + ADsUserAccess() { try { @@ -121,12 +121,12 @@ public: m_aMap[facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber"); m_aMap[mail] = Str(pUser, &IADsUser::get_EmailAddress); - CacheData(xContext); + CacheData(); } catch (sal::systools::ComError&) { // Maybe we temporarily lost connection to AD; try to get cached data - GetCachedData(xContext); + GetCachedData(); } } @@ -186,7 +186,7 @@ private: return ""; } - void CacheData(const css::uno::Reference<css::uno::XComponentContext>& xContext) + void CacheData() { try { @@ -212,7 +212,7 @@ private: comphelper::Base64::encode(sOutBuf, seqCachedData); std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create(xContext)); + comphelper::ConfigurationChanges::create()); officecfg::UserProfile::WinUserInfo::Cache::set(sOutBuf.makeStringAndClear(), batch); batch->commit(); } @@ -223,12 +223,12 @@ private: } } - void GetCachedData(const css::uno::Reference<css::uno::XComponentContext>& xContext) + void GetCachedData() { if (m_sUserDN.isEmpty()) throw css::uno::RuntimeException(); - OUString sCache = officecfg::UserProfile::WinUserInfo::Cache::get(xContext); + OUString sCache = officecfg::UserProfile::WinUserInfo::Cache::get(); if (sCache.isEmpty()) throw css::uno::RuntimeException(); @@ -308,13 +308,13 @@ namespace config { namespace WinUserInfo { -WinUserInfoBe::WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext) +WinUserInfoBe::WinUserInfoBe() : WinUserInfoMutexHolder() , BackendBase(mMutex) { try { - m_pImpl.reset(new ADsUserAccess(xContext)); + m_pImpl.reset(new ADsUserAccess()); } catch (css::uno::RuntimeException&) { @@ -429,10 +429,10 @@ css::uno::Sequence<OUString> SAL_CALL WinUserInfoBe::getSupportedServiceNames() } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext* context, +extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&) { - return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe(context)); + return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx index 7914121469c7..30ca088c3aca 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx @@ -51,7 +51,7 @@ struct WinUserInfoMutexHolder class WinUserInfoBe : private WinUserInfoMutexHolder, public BackendBase { public: - explicit WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext); + explicit WinUserInfoBe(); virtual ~WinUserInfoBe() override; // XServiceInfo |