diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-03-17 16:14:27 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-03-17 16:52:34 +0100 |
commit | ab3acb7ef79fcae8776b8d1ce0e81da5698ef516 (patch) | |
tree | 0dad3a5d6c6897887cc8ff5c6837d83b7e89a070 /framework/source/accelerators | |
parent | 803a8a04e980d24bf6c336e4416615a49614367f (diff) |
Consolidate framework::{Read,Write}Guard
...now that it is obvious that they both do the same
Change-Id: I6878acca4750ef4204fe32a695b6d9e1c5140115
Diffstat (limited to 'framework/source/accelerators')
7 files changed, 79 insertions, 87 deletions
diff --git a/framework/source/accelerators/acceleratorcache.cxx b/framework/source/accelerators/acceleratorcache.cxx index b5cdfc9627f5..d54cbf9ed1f9 100644 --- a/framework/source/accelerators/acceleratorcache.cxx +++ b/framework/source/accelerators/acceleratorcache.cxx @@ -20,8 +20,7 @@ #include <accelerators/acceleratorcache.hxx> #include <xml/acceleratorconfigurationreader.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/guard.hxx> #include <com/sun/star/container/ElementExistException.hpp> @@ -57,7 +56,7 @@ AcceleratorCache::~AcceleratorCache() void AcceleratorCache::takeOver(const AcceleratorCache& rCopy) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); m_lCommand2Keys = rCopy.m_lCommand2Keys; m_lKey2Commands = rCopy.m_lKey2Commands; @@ -77,7 +76,7 @@ AcceleratorCache& AcceleratorCache::operator=(const AcceleratorCache& rCopy) sal_Bool AcceleratorCache::hasKey(const css::awt::KeyEvent& aKey) const { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return (m_lKey2Commands.find(aKey) != m_lKey2Commands.end()); // <- SAFE ---------------------------------- @@ -87,7 +86,7 @@ sal_Bool AcceleratorCache::hasKey(const css::awt::KeyEvent& aKey) const sal_Bool AcceleratorCache::hasCommand(const OUString& sCommand) const { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return (m_lCommand2Keys.find(sCommand) != m_lCommand2Keys.end()); // <- SAFE ---------------------------------- @@ -99,7 +98,7 @@ AcceleratorCache::TKeyList AcceleratorCache::getAllKeys() const TKeyList lKeys; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); lKeys.reserve(m_lKey2Commands.size()); TKey2Commands::const_iterator pIt; @@ -122,7 +121,7 @@ void AcceleratorCache::setKeyCommandPair(const css::awt::KeyEvent& aKey , const OUString& sCommand) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); // register command for the specified key m_lKey2Commands[aKey] = sCommand; @@ -141,7 +140,7 @@ AcceleratorCache::TKeyList AcceleratorCache::getKeysByCommand(const OUString& sC TKeyList lKeys; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); TCommand2Keys::const_iterator pCommand = m_lCommand2Keys.find(sCommand); if (pCommand == m_lCommand2Keys.end()) @@ -161,7 +160,7 @@ OUString AcceleratorCache::getCommandByKey(const css::awt::KeyEvent& aKey) const OUString sCommand; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); TKey2Commands::const_iterator pKey = m_lKey2Commands.find(aKey); if (pKey == m_lKey2Commands.end()) @@ -179,7 +178,7 @@ OUString AcceleratorCache::getCommandByKey(const css::awt::KeyEvent& aKey) const void AcceleratorCache::removeKey(const css::awt::KeyEvent& aKey) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); // check if key exists TKey2Commands::const_iterator pKey = m_lKey2Commands.find(aKey); @@ -206,7 +205,7 @@ void AcceleratorCache::removeKey(const css::awt::KeyEvent& aKey) void AcceleratorCache::removeCommand(const OUString& sCommand) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); const TKeyList& lKeys = getKeysByCommand(sCommand); AcceleratorCache::TKeyList::const_iterator pKey ; diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 51078b5773df..56285782a7c5 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -25,8 +25,7 @@ #include <xml/acceleratorconfigurationreader.hxx> #include <xml/acceleratorconfigurationwriter.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/guard.hxx> #include <acceleratorconst.h> #include <services.h> @@ -93,7 +92,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfigurati throw(css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache& rCache = impl_getCFG(); AcceleratorCache::TKeyList lKeys = rCache.getAllKeys(); @@ -108,7 +107,7 @@ OUString SAL_CALL XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(const c css::uno::RuntimeException, std::exception ) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache& rCache = impl_getCFG(); if (!rCache.hasKey(aKeyEvent)) @@ -144,7 +143,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyE 1); // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache& rCache = impl_getCFG(sal_True); // sal_True => force getting of a writeable cache! rCache.setKeyCommandPair(aKeyEvent, sCommand); @@ -159,7 +158,7 @@ throw(css::container::NoSuchElementException, css::uno::RuntimeException, std::exception ) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache& rCache = impl_getCFG(sal_True); // true => force using of a writeable cache if (!rCache.hasKey(aKeyEvent)) @@ -184,7 +183,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfigurati 1); // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache& rCache = impl_getCFG(); if (!rCache.hasCommand(sCommand)) @@ -204,7 +203,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::g css::uno::RuntimeException, std::exception ) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); sal_Int32 i = 0; sal_Int32 c = lCommandList.getLength(); @@ -250,7 +249,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(co 0); // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache& rCache = impl_getCFG(sal_True); // sal_True => force getting of a writeable cache! if (!rCache.hasCommand(sCommand)) @@ -271,7 +270,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reload() css::uno::Reference< css::io::XStream > xStreamNoLang; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // sal_True => open or create! try { @@ -291,7 +290,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reload() // impl_ts_load() does not clear the cache // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); m_aReadCache = AcceleratorCache(); aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -314,7 +313,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::store() css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // sal_True => open or create! aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -365,7 +364,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::R throw(css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return (m_pWriteCache != 0); // <- SAFE ---------------------------------- } @@ -375,7 +374,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::R throw(css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // sal_True => open or create! aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -420,7 +419,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reset() throw(css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT()); aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -453,7 +452,7 @@ void XMLBasedAcceleratorConfiguration::changesOccurred(const OUString& /*sPath*/ void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< css::io::XInputStream >& xStream) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; if (m_pWriteCache) @@ -502,7 +501,7 @@ void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< c void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< css::io::XOutputStream >& xStream) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache aCache; sal_Bool bChanged = (m_pWriteCache != 0); @@ -534,7 +533,7 @@ void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< c // take over all changes into the original container // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); // take over all changes into the readonly cache ... // and forget the copy-on-write copied cache @@ -555,7 +554,7 @@ void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< c AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteAccessRequested) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); //create copy of our readonly-cache, if write access is forced ... but //not still possible! @@ -615,7 +614,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati throw(css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set @@ -637,7 +636,7 @@ OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const c css::uno::RuntimeException, std::exception ) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True ); AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False); @@ -681,7 +680,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyE 1); // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); // sal_True => force getting of a writeable cache! AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); // sal_True => force getting of a writeable cache! @@ -748,7 +747,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::K css::uno::RuntimeException, std::exception ) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); @@ -798,7 +797,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati 1); // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True ); AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False); @@ -845,7 +844,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g css::uno::RuntimeException, std::exception ) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); sal_Int32 i = 0; sal_Int32 c = lCommandList.getLength(); @@ -895,7 +894,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(co 0); // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); @@ -922,7 +921,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::reload() SAL_INFO( "fwk.accelerators", "XCUBasedAcceleratorConfiguration::reload()" ); // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); sal_Bool bPreferred; css::uno::Reference< css::container::XNameAccess > xAccess; @@ -963,7 +962,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::store() SAL_INFO( "fwk.accelerators", "XCUBasedAcceleratorConfiguration::store()" ); // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); sal_Bool bPreferred; css::uno::Reference< css::container::XNameAccess > xAccess; @@ -1010,7 +1009,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R // the original m_aCache has been split into primay cache and secondary cache... // we should merge them before storing to storage // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); AcceleratorCache aCache; if (m_pPrimaryWriteCache != 0) @@ -1350,7 +1349,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const c // take over all changes into the original container // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); if (m_pPrimaryWriteCache) { @@ -1394,7 +1393,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const c // take over all changes into the original container // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); if (m_pSecondaryWriteCache) { @@ -1559,7 +1558,7 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const OUString& sPrimarySe AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); if (bPreferred) { diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index e3881f8248f2..1824c409b7de 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -25,8 +25,7 @@ #include <xml/acceleratorconfigurationwriter.hxx> #include <xml/saxnamespacefilter.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/guard.hxx> #include <acceleratorconst.h> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -116,7 +115,7 @@ DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments) : DocumentAcceleratorConfiguration_BASE(xContext) { - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); css::uno::Reference<css::embed::XStorage> xRoot; if (lArguments.getLength() == 1 && (lArguments[0] >>= xRoot)) @@ -149,7 +148,7 @@ void SAL_CALL DocumentAcceleratorConfiguration::setStorage(const css::uno::Refer // Attention! xStorage must be accepted too, if it's NULL ! // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); sal_Bool bForgetOldStorages = m_xDocumentRoot.is(); m_xDocumentRoot = xStorage; aWriteLock.unlock(); @@ -167,7 +166,7 @@ sal_Bool SAL_CALL DocumentAcceleratorConfiguration::hasStorage() throw(css::uno::RuntimeException, std::exception) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return m_xDocumentRoot.is(); // <- SAFE ---------------------------------- } @@ -176,7 +175,7 @@ sal_Bool SAL_CALL DocumentAcceleratorConfiguration::hasStorage() void DocumentAcceleratorConfiguration::impl_ts_fillCache() { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xDocumentRoot = m_xDocumentRoot; aReadLock.unlock(); // <- SAFE ---------------------------------- diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx index 6233d40712ae..2824e97a559d 100644 --- a/framework/source/accelerators/globalacceleratorconfiguration.cxx +++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx @@ -19,8 +19,6 @@ #include <accelerators/acceleratorconfiguration.hxx> #include <accelerators/presethandler.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> #include <helper/mischelper.hxx> #include <acceleratorconst.h> diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx index 5b832e2e4835..7614f49f2b69 100644 --- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx +++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx @@ -19,8 +19,7 @@ #include <accelerators/acceleratorconfiguration.hxx> #include <accelerators/presethandler.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/guard.hxx> #include "helper/mischelper.hxx" #include <acceleratorconst.h> @@ -110,7 +109,7 @@ ModuleAcceleratorConfiguration::ModuleAcceleratorConfiguration( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lArguments) : ModuleAcceleratorConfiguration_BASE(xContext) { - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); OUString sModule; if (lArguments.getLength() == 1 && (lArguments[0] >>= sModule)) @@ -138,7 +137,7 @@ ModuleAcceleratorConfiguration::~ModuleAcceleratorConfiguration() void ModuleAcceleratorConfiguration::fillCache() { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); m_sModuleCFG = m_sModule; aReadLock.unlock(); // <- SAFE ---------------------------------- diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index bc12a8e1bda7..8071fae3d71d 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -22,8 +22,7 @@ #include <classes/fwkresid.hxx> #include "classes/resource.hrc" -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/guard.hxx> #include <services.h> #include <com/sun/star/beans/XPropertySet.hpp> @@ -147,7 +146,7 @@ PresetHandler::~PresetHandler() void PresetHandler::forgetCachedStorages() { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); if (m_eConfigType == E_DOCUMENT) { @@ -210,7 +209,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag return xRoot; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -268,7 +267,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag return xRoot; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -312,7 +311,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag css::uno::Reference< css::embed::XStorage > PresetHandler::getWorkingStorageShare() { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return m_xWorkingStorageShare; // <- SAFE ---------------------------------- } @@ -321,7 +320,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getWorkingStorageShar css::uno::Reference< css::embed::XStorage > PresetHandler::getWorkingStorageUser() { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return m_xWorkingStorageUser; // <- SAFE ---------------------------------- } @@ -330,7 +329,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getWorkingStorageUser css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare(const css::uno::Reference< css::embed::XStorage >& /*xChild*/) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageShare; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -342,7 +341,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser(const css::uno::Reference< css::embed::XStorage >& /*xChild*/) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageUser; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -360,7 +359,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType // TODO free all current open storages! // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); m_eConfigType = eConfigType ; m_sResourceType = sResource ; @@ -565,7 +564,7 @@ void PresetHandler::copyPresetToTarget(const OUString& sPreset, // We try to open it and forward all errors to the user! // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xWorkingShare = m_xWorkingStorageShare; css::uno::Reference< css::embed::XStorage > xWorkingNoLang= m_xWorkingStorageNoLang; css::uno::Reference< css::embed::XStorage > xWorkingUser = m_xWorkingStorageUser ; @@ -605,7 +604,7 @@ css::uno::Reference< css::io::XStream > PresetHandler::openPreset(const OUString sal_Bool bUseNoLangGlobal) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xFolder = bUseNoLangGlobal? m_xWorkingStorageNoLang: m_xWorkingStorageShare; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -627,7 +626,7 @@ css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const OUString sal_Bool bCreateIfMissing) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xFolder = m_xWorkingStorageUser; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -667,7 +666,7 @@ css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const OUString void PresetHandler::commitUserChanges() { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageUser; EConfigType eCfgType = m_eConfigType; aReadLock.unlock(); @@ -704,7 +703,7 @@ void PresetHandler::commitUserChanges() void PresetHandler::addStorageListener(IStorageListener* pListener) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); OUString sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer! EConfigType eCfgType = m_eConfigType; aReadLock.unlock(); @@ -734,7 +733,7 @@ void PresetHandler::addStorageListener(IStorageListener* pListener) void PresetHandler::removeStorageListener(IStorageListener* pListener) { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); OUString sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer! EConfigType eCfgType = m_eConfigType; aReadLock.unlock(); diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx index e3bdfb1daebd..05227705618d 100644 --- a/framework/source/accelerators/storageholder.cxx +++ b/framework/source/accelerators/storageholder.cxx @@ -19,8 +19,7 @@ #include <accelerators/storageholder.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> +#include <threadhelp/guard.hxx> #include <services.h> #include <com/sun/star/container/NoSuchElementException.hpp> @@ -65,7 +64,7 @@ StorageHolder::~StorageHolder() void StorageHolder::forgetCachedStorages() { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); TPath2StorageInfo::iterator pIt; for ( pIt = m_lStorages.begin(); @@ -86,7 +85,7 @@ void StorageHolder::forgetCachedStorages() void StorageHolder::setRootStorage(const css::uno::Reference< css::embed::XStorage >& xRoot) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); m_xRoot = xRoot; aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -96,7 +95,7 @@ void StorageHolder::setRootStorage(const css::uno::Reference< css::embed::XStora css::uno::Reference< css::embed::XStorage > StorageHolder::getRootStorage() const { // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); return m_xRoot; // <- SAFE ---------------------------------- } @@ -109,7 +108,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri OUStringList lFolders = StorageHolder::impl_st_parsePath(sNormedPath); // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); css::uno::Reference< css::embed::XStorage > xParent = m_xRoot; aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -167,7 +166,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri } // SAFE -> ------------------------------ - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); pInfo = &(m_lStorages[sCheckPath]); pInfo->Storage = xChild; pInfo->UseCount = 1; @@ -197,7 +196,7 @@ StorageHolder::TStorageList StorageHolder::getAllPathStorages(const OUString& sP OUStringList::const_iterator pIt ; // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); for ( pIt = lFolders.begin(); pIt != lFolders.end() ; @@ -248,7 +247,7 @@ void StorageHolder::commitPath(const OUString& sPath) } // SAFE -> ------------------------------ - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); xCommit = css::uno::Reference< css::embed::XTransactedObject >(m_xRoot, css::uno::UNO_QUERY); aReadLock.unlock(); // <- SAFE ------------------------------ @@ -282,7 +281,7 @@ void StorageHolder::closePath(const OUString& rPath) } // SAFE -> ------------------------------ - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); OUStringList::reverse_iterator pIt2; for ( pIt2 = lFolders.rbegin(); @@ -313,7 +312,7 @@ void StorageHolder::notifyPath(const OUString& sPath) OUString sNormedPath = StorageHolder::impl_st_normPath(sPath); // SAFE -> ------------------------------ - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); TPath2StorageInfo::iterator pIt1 = m_lStorages.find(sNormedPath); if (pIt1 == m_lStorages.end()) @@ -341,7 +340,7 @@ void StorageHolder::addStorageListener( IStorageListener* pListener, OUString sNormedPath = StorageHolder::impl_st_normPath(sPath); // SAFE -> ------------------------------ - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); TPath2StorageInfo::iterator pIt1 = m_lStorages.find(sNormedPath); if (pIt1 == m_lStorages.end()) @@ -363,7 +362,7 @@ void StorageHolder::removeStorageListener( IStorageListener* pListener, OUString sNormedPath = StorageHolder::impl_st_normPath(sPath); // SAFE -> ------------------------------ - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); TPath2StorageInfo::iterator pIt1 = m_lStorages.find(sNormedPath); if (pIt1 == m_lStorages.end()) @@ -382,7 +381,7 @@ void StorageHolder::removeStorageListener( IStorageListener* pListener, OUString StorageHolder::getPathOfStorage(const css::uno::Reference< css::embed::XStorage >& xStorage) { // SAFE -> ------------------------------ - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); TPath2StorageInfo::const_iterator pIt; for ( pIt = m_lStorages.begin(); @@ -426,7 +425,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::getParentStorage(cons return css::uno::Reference< css::embed::XStorage >(); // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); + Guard aReadLock(m_aLock); // b) if (c < 2) @@ -457,7 +456,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::getParentStorage(cons void StorageHolder::operator=(const StorageHolder& rCopy) { // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); + Guard aWriteLock(m_aLock); m_xRoot = rCopy.m_xRoot; m_lStorages = rCopy.m_lStorages; |