From 4256c764aee0777770466115a97420d9b55c23ac Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Sat, 5 Mar 2022 11:23:38 +0100 Subject: do not pass XComponentContext to officecfg::...::get() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ucb/source/ucp/webdav-curl/CurlSession.cxx | 4 ++-- ucb/source/ucp/webdav-curl/webdavcontent.cxx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index 90ce91c3cddc..3e48874c3108 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -650,7 +650,7 @@ CurlSession::CurlSession(uno::Reference const& xContext, throw DAVException(DAVException::DAV_SESSION_CREATE, ConnectionEndPointString(m_URI.GetHost(), m_URI.GetPort())); } - auto const connectTimeout(officecfg::Inet::Settings::ConnectTimeout::get(m_xContext)); + auto const connectTimeout(officecfg::Inet::Settings::ConnectTimeout::get()); // default is 300s rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_CONNECTTIMEOUT, ::std::max(2L, ::std::min(connectTimeout, 180L))); @@ -660,7 +660,7 @@ CurlSession::CurlSession(uno::Reference const& xContext, throw DAVException(DAVException::DAV_SESSION_CREATE, ConnectionEndPointString(m_URI.GetHost(), m_URI.GetPort())); } - auto const readTimeout(officecfg::Inet::Settings::ReadTimeout::get(m_xContext)); + auto const readTimeout(officecfg::Inet::Settings::ReadTimeout::get()); m_nReadTimeout = ::std::max(20, ::std::min(readTimeout, 180)) * 1000; // default is infinite rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_TIMEOUT, 300L); diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 30f141368e3a..8528f31fa263 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -3971,23 +3971,23 @@ void Content::initOptsCacheLifeTime() // officecfg/registry/schema/org/openoffice/Inet.xcs // for use of these field values. sal_uInt32 nAtime; - nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext ); + nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get(); m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ), std::min( nAtime, sal_uInt32( 3600 ) ) ); - nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext ); + nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get(); m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ), std::min( nAtime, sal_uInt32( 3600 ) ) ); - nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( m_xContext ); + nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get(); m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ), std::min( nAtime, sal_uInt32( 3600 ) ) ); - nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext ); + nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get(); m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ), std::min( nAtime, sal_uInt32( 43200 ) ) ); - nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext ); + nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get(); m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ), std::min( nAtime, sal_uInt32( 30 ) ) ); } -- cgit