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 /svx | |
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 'svx')
-rw-r--r-- | svx/source/dialog/charmap.cxx | 5 | ||||
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 3617e48a82c8..23b6cda06ec7 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -64,7 +64,6 @@ FactoryFunction SvxShowCharSet::GetUITestFactory() const SvxShowCharSet::SvxShowCharSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow, const VclPtr<VirtualDevice>& rVirDev) : mxVirDev(rVirDev) , mxScrollArea(std::move(pScrolledWindow)) - , mxContext(comphelper::getProcessComponentContext()) , nX(0) , nY(0) , maFontSize(0, 0) @@ -302,7 +301,7 @@ void SvxShowCharSet::updateFavCharacterList(const OUString& sTitle, const OUStri aFavCharFontListRange[i] = maFavCharFontList[i]; } - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext)); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::set(aFavCharList, batch); officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::set(aFavCharFontList, batch); batch->commit(); @@ -339,7 +338,7 @@ void SvxShowCharSet::updateFavCharacterList(const OUString& sTitle, const OUStri aFavCharFontListRange[i] = maFavCharFontList[i]; } - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext)); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::set(aFavCharList, batch); officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::set(aFavCharFontList, batch); batch->commit(); diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index cfc7eedeeeaf..55b2fdbd8a2d 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -61,8 +61,7 @@ PaletteManager::PaletteManager() : mnCurrentPalette(0), mnColorCount(0), mpBtnUpdater(nullptr), - maColorSelectFunction(PaletteManager::DispatchColorCommand), - m_context(comphelper::getProcessComponentContext()) + maColorSelectFunction(PaletteManager::DispatchColorCommand) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); if(pDocSh) @@ -294,7 +293,7 @@ void PaletteManager::SetPalette( sal_Int32 nPos ) OUString aPaletteName(officecfg::Office::Common::UserColors::PaletteName::get()); if (aPaletteName != GetPaletteName()) { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Common::UserColors::PaletteName::set(GetPaletteName(), batch); batch->commit(); } @@ -363,7 +362,7 @@ void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& r aColorListRange[i] = static_cast<sal_Int32>(maRecentColors[i].first); aColorNameListRange[i] = maRecentColors[i].second; } - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Common::UserColors::RecentColor::set(aColorList, batch); officecfg::Office::Common::UserColors::RecentColorName::set(aColorNameList, batch); batch->commit(); |