framework/inc/services/dispatchhelper.hxx | 6 framework/inc/uiconfiguration/globalsettings.hxx | 1 framework/inc/uifactory/factoryconfiguration.hxx | 3 framework/source/inc/loadenv/loadenv.hxx | 4 framework/source/loadenv/loadenv.cxx | 138 +++++++------------- framework/source/services/dispatchhelper.cxx | 24 +-- framework/source/uiconfiguration/globalsettings.cxx | 17 -- framework/source/uifactory/factoryconfiguration.cxx | 33 +--- 8 files changed, 79 insertions(+), 147 deletions(-)
New commits: commit 85f7ed1c74364505356ff27e8269f2268536fdc6 Author: Stephan Bergmann <[email protected]> Date: Thu Mar 20 10:49:20 2014 +0100 Use an osl::Mutex directly Change-Id: I2e2a7c380ca593ad957c3b0085d01971c843f172 diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index 2642f09..29b6599 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -22,7 +22,6 @@ #include <loadenv/loadenvexception.hxx> #include <loadenv/actionlockguard.hxx> -#include <threadhelp/threadhelpbase.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -52,7 +51,7 @@ class QuietInteraction; @author as96863 */ -class LoadEnv : private ThreadHelpBase +class LoadEnv { public: @@ -106,6 +105,7 @@ public: }; private: + mutable osl::Mutex m_mutex; /** @short reference to an uno service manager, which must be used to created on needed services on demand. diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 1b07490..7bfabd2 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -23,7 +23,6 @@ #include <framework/framelistanalyzer.hxx> #include <interaction/quietinteraction.hxx> -#include <threadhelp/guard.hxx> #include <properties.h> #include <protocols.h> #include <services.h> @@ -132,8 +131,7 @@ class LoadEnvListener : public ::cppu::WeakImplHelper2< css::frame::XLoadEventLi LoadEnv::LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xContext) throw(LoadEnvException, css::uno::RuntimeException) - : ThreadHelpBase( ) - , m_xContext (xContext) + : m_xContext (xContext) , m_pQuietInteraction( 0 ) { } @@ -232,8 +230,7 @@ void LoadEnv::initializeLoading(const OUString& EFeature eFeature , // => use default ... EContentType eContentType ) // => use default ... { - // SAFE -> ---------------------------------- - Guard aWriteLock(m_aLock); + osl::MutexGuard g(m_mutex); // Handle still running processes! if (m_xAsynchronousJob.is()) @@ -300,9 +297,6 @@ void LoadEnv::initializeLoading(const OUString& bUIMode, &m_pQuietInteraction ); - - aWriteLock.unlock(); - // <- SAFE ---------------------------------- } @@ -358,7 +352,7 @@ void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XCompon void LoadEnv::startLoading() { // SAFE -> - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); // Handle still running processes! if (m_xAsynchronousJob.is()) @@ -370,7 +364,7 @@ void LoadEnv::startLoading() throw LoadEnvException(LoadEnvException::ID_UNSUPPORTED_CONTENT, "from LoadEnv::startLoading"); // <- SAFE - aReadLock.unlock(); + aReadLock.clear(); // detect its type/filter etc. // These information will be available by the @@ -420,10 +414,10 @@ sal_Bool LoadEnv::waitWhileLoading(sal_uInt32 nTimeout) while(true) { // SAFE -> ------------------------------ - Guard aReadLock1(m_aLock); + osl::ClearableMutexGuard aReadLock1(m_mutex); if (!m_xAsynchronousJob.is()) break; - aReadLock1.unlock(); + aReadLock1.clear(); // <- SAFE ------------------------------ Application::Yield(); @@ -438,16 +432,13 @@ sal_Bool LoadEnv::waitWhileLoading(sal_uInt32 nTimeout) break; } - // SAFE -> ---------------------------------- - Guard aReadLock2(m_aLock); + osl::MutexGuard g(m_mutex); return !m_xAsynchronousJob.is(); - // <- SAFE ---------------------------------- } css::uno::Reference< css::lang::XComponent > LoadEnv::getTargetComponent() const { - // SAFE -> - Guard aReadLock(m_aLock); + osl::MutexGuard g(m_mutex); if (!m_xTargetFrame.is()) return css::uno::Reference< css::lang::XComponent >(); @@ -461,7 +452,6 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::getTargetComponent() const return css::uno::Reference< css::lang::XComponent >(xController, css::uno::UNO_QUERY); return css::uno::Reference< css::lang::XComponent >(xModel, css::uno::UNO_QUERY); - // <- SAFE } @@ -523,8 +513,7 @@ void SAL_CALL LoadEnvListener::disposing(const css::lang::EventObject&) void LoadEnv::impl_setResult(sal_Bool bResult) { - // SAFE -> ---------------------------------- - Guard aWriteLock(m_aLock); + osl::MutexGuard g(m_mutex); m_bLoaded = bResult; @@ -534,9 +523,6 @@ void LoadEnv::impl_setResult(sal_Bool bResult) // So we must be sure, that loading process was really finished. // => do it as last operation of this method ... m_xAsynchronousJob.clear(); - - aWriteLock.unlock(); - // <- SAFE ---------------------------------- } /*----------------------------------------------- @@ -776,7 +762,7 @@ void LoadEnv::impl_detectTypeAndFilter() static sal_Int32 FILTERFLAG_TEMPLATEPATH = 16; // SAFE -> - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); // Attention: Because our stl media descriptor is a copy of an uno sequence // we can't use as an in/out parameter here. Copy it before and don't forget to @@ -784,7 +770,7 @@ void LoadEnv::impl_detectTypeAndFilter() css::uno::Sequence< css::beans::PropertyValue > lDescriptor = m_lMediaDescriptor.getAsConstPropertyValueList(); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE OUString sType, sFilter; @@ -811,7 +797,7 @@ void LoadEnv::impl_detectTypeAndFilter() LoadEnvException::ID_UNSUPPORTED_CONTENT, "type detection failed"); // SAFE -> - Guard aWriteLock(m_aLock); + osl::ResettableMutexGuard aWriteLock(m_mutex); // detection was successfully => update the descriptor member of this class m_lMediaDescriptor << lDescriptor; @@ -820,7 +806,7 @@ void LoadEnv::impl_detectTypeAndFilter() // see below ... sFilter = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_FILTERNAME(), OUString()); - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE // But the type isn't enough. For loading sometimes we need more information. @@ -842,9 +828,9 @@ void LoadEnv::impl_detectTypeAndFilter() if (!sFilter.isEmpty()) { // SAFE -> - aWriteLock.lock(); + aWriteLock.reset(); m_lMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter; - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE } } @@ -876,12 +862,12 @@ void LoadEnv::impl_detectTypeAndFilter() if (bIsOwnTemplate) { // SAFE -> - aWriteLock.lock(); + aWriteLock.reset(); // Don't overwrite external decisions! See comments before ... utl::MediaDescriptor::const_iterator pAsTemplateItem = m_lMediaDescriptor.find(utl::MediaDescriptor::PROP_ASTEMPLATE()); if (pAsTemplateItem == m_lMediaDescriptor.end()) m_lMediaDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE()] <<= sal_True; - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE } } @@ -891,7 +877,7 @@ sal_Bool LoadEnv::impl_handleContent() throw(LoadEnvException, css::uno::RuntimeException) { // SAFE -> ----------------------------------- - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); // the type must exist inside the descriptor ... otherwise this class is implemented wrong :-) OUString sType = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_TYPENAME(), OUString()); @@ -906,7 +892,7 @@ sal_Bool LoadEnv::impl_handleContent() // get necessary container to query for a handler object css::uno::Reference< css::frame::XLoaderFactory > xLoaderFactory = css::frame::ContentHandlerFactory::create(m_xContext); - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE ----------------------------------- // query @@ -938,10 +924,10 @@ sal_Bool LoadEnv::impl_handleContent() { continue; } // SAFE -> ----------------------------------- - Guard aWriteLock(m_aLock); + osl::ClearableMutexGuard aWriteLock(m_mutex); m_xAsynchronousJob = xHandler; LoadEnvListener* pListener = new LoadEnvListener(this); - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE ----------------------------------- css::uno::Reference< css::frame::XDispatchResultListener > xListener(static_cast< css::frame::XDispatchResultListener* >(pListener), css::uno::UNO_QUERY); @@ -957,9 +943,9 @@ sal_Bool LoadEnv::impl_handleContent() sal_Bool LoadEnv::impl_furtherDocsAllowed() { // SAFE -> - Guard aReadLock(m_aLock); + osl::ResettableMutexGuard aReadLock(m_mutex); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE sal_Bool bAllowed = sal_True; @@ -1002,11 +988,11 @@ sal_Bool LoadEnv::impl_furtherDocsAllowed() if ( ! bAllowed ) { // SAFE -> - aReadLock.lock(); + aReadLock.reset(); css::uno::Reference< css::task::XInteractionHandler > xInteraction = m_lMediaDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_INTERACTIONHANDLER(), css::uno::Reference< css::task::XInteractionHandler >()); - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE if (xInteraction.is()) @@ -1039,7 +1025,7 @@ sal_Bool LoadEnv::impl_loadContent() throw(LoadEnvException, css::uno::RuntimeException) { // SAFE -> ----------------------------------- - Guard aWriteLock(m_aLock); + osl::ClearableMutexGuard aWriteLock(m_mutex); // search or create right target frame OUString sTarget = m_sTarget; @@ -1144,11 +1130,9 @@ sal_Bool LoadEnv::impl_loadContent() if (xAsyncLoader.is()) { - // SAFE -> ----------------------------------- - aWriteLock.lock(); m_xAsynchronousJob = xAsyncLoader; LoadEnvListener* pListener = new LoadEnvListener(this); - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE ----------------------------------- css::uno::Reference< css::frame::XLoadEventListener > xListener(static_cast< css::frame::XLoadEventListener* >(pListener), css::uno::UNO_QUERY); @@ -1167,7 +1151,7 @@ sal_Bool LoadEnv::impl_loadContent() return sal_True; } - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE return sal_False; @@ -1177,7 +1161,7 @@ sal_Bool LoadEnv::impl_loadContent() css::uno::Reference< css::uno::XInterface > LoadEnv::impl_searchLoader() { // SAFE -> ----------------------------------- - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); // special mode to set an existing component on this frame // In such case the loader is fix. It must be the SFX based implementation, @@ -1205,7 +1189,7 @@ css::uno::Reference< css::uno::XInterface > LoadEnv::impl_searchLoader() // try to locate any interested frame loader css::uno::Reference< css::frame::XLoaderFactory > xLoaderFactory = css::frame::FrameLoaderFactory::create(m_xContext); - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE ----------------------------------- css::uno::Sequence< OUString > lTypesReg(1); @@ -1252,9 +1236,9 @@ void LoadEnv::impl_jumpToMark(const css::uno::Reference< css::frame::XFrame >& x return; // SAFE -> - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE css::util::URL aCmd; @@ -1276,8 +1260,7 @@ void LoadEnv::impl_jumpToMark(const css::uno::Reference< css::frame::XFrame >& x css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() throw(LoadEnvException, css::uno::RuntimeException) { - // SAFE -> - Guard aReadLock(m_aLock); + osl::MutexGuard g(m_mutex); // such search is allowed for special requests only ... // or better its not allowed for some requests in general :-) @@ -1411,9 +1394,6 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() impl_makeFrameWindowVisible(xResult->getContainerWindow(), sal_True); } - aReadLock.unlock(); - // <- SAFE - return xResult; } @@ -1437,7 +1417,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() throw(LoadEnvException, css::uno::RuntimeException) { // SAFE -> .................................. - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); // The special backing mode frame will be recycled by definition! // It doesn't matter if somewhere wants to create a new view @@ -1520,7 +1500,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() SvtModuleOptions::EFactory eOldApp = SvtModuleOptions::ClassifyFactoryByModel(xModel); SvtModuleOptions::EFactory eNewApp = SvtModuleOptions::ClassifyFactoryByURL (m_aURL.Complete, m_lMediaDescriptor.getAsConstPropertyValueList()); - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE .................................. if (eOldApp != eNewApp) @@ -1548,14 +1528,14 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() } // SAFE -> .................................. - Guard aWriteLock(m_aLock); + osl::ClearableMutexGuard aWriteLock(m_mutex); css::uno::Reference< css::document::XActionLockable > xLock(xTask, css::uno::UNO_QUERY); if (!m_aTargetLock.setResource(xLock)) return css::uno::Reference< css::frame::XFrame >(); m_bReactivateControllerOnError = bReactivateOldControllerOnError; - aWriteLock.unlock(); + aWriteLock.clear(); // <- SAFE .................................. // bring it to front ... @@ -1571,7 +1551,7 @@ void LoadEnv::impl_reactForLoadingState() /*TODO reset action locks */ // SAFE -> ---------------------------------- - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); if (m_bLoaded) { @@ -1671,7 +1651,7 @@ void LoadEnv::impl_reactForLoadingState() bThrow = true; } - aReadLock.unlock(); + aReadLock.clear(); if (bThrow) { @@ -1689,9 +1669,9 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X sal_Bool bForceToFront) { // SAFE -> ---------------------------------- - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE ---------------------------------- SolarMutexGuard aSolarGuard; @@ -1761,7 +1741,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw // <- SOLAR SAFE // SAFE -> - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); // no filter -> no module -> no persistent window state OUString sFilter = m_lMediaDescriptor.getUnpackedValueOrDefault( @@ -1772,7 +1752,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); + aReadLock.clear(); // <- SAFE try commit 8781cdcc5b798ae2bdf3edba34b335d068339d4e Author: Stephan Bergmann <[email protected]> Date: Thu Mar 20 10:39:33 2014 +0100 Use an osl::Mutex directly Change-Id: I5dc6e56bcbec5055da629d4dfda608f266191ef9 diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 8079c4b..1b07490 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -93,12 +93,11 @@ namespace framework { using namespace com::sun::star; -class LoadEnvListener : private ThreadHelpBase - , public ::cppu::WeakImplHelper2< css::frame::XLoadEventListener , +class LoadEnvListener : public ::cppu::WeakImplHelper2< css::frame::XLoadEventListener , css::frame::XDispatchResultListener > { private: - + osl::Mutex m_mutex; bool m_bWaitingResult; LoadEnv* m_pLoadEnv; @@ -469,38 +468,27 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::getTargetComponent() const void SAL_CALL LoadEnvListener::loadFinished(const css::uno::Reference< css::frame::XFrameLoader >&) throw(css::uno::RuntimeException, std::exception) { - // SAFE -> ---------------------------------- - Guard aWriteLock(m_aLock); - + osl::MutexGuard g(m_mutex); if (m_bWaitingResult) m_pLoadEnv->impl_setResult(sal_True); m_bWaitingResult = false; - - aWriteLock.unlock(); - // <- SAFE ---------------------------------- } void SAL_CALL LoadEnvListener::loadCancelled(const css::uno::Reference< css::frame::XFrameLoader >&) throw(css::uno::RuntimeException, std::exception) { - // SAFE -> ---------------------------------- - Guard aWriteLock(m_aLock); - + osl::MutexGuard g(m_mutex); if (m_bWaitingResult) m_pLoadEnv->impl_setResult(sal_False); m_bWaitingResult = false; - - aWriteLock.unlock(); - // <- SAFE ---------------------------------- } void SAL_CALL LoadEnvListener::dispatchFinished(const css::frame::DispatchResultEvent& aEvent) throw(css::uno::RuntimeException, std::exception) { - // SAFE -> ---------------------------------- - Guard aWriteLock(m_aLock); + osl::MutexGuard g(m_mutex); if (!m_bWaitingResult) return; @@ -520,24 +508,16 @@ void SAL_CALL LoadEnvListener::dispatchFinished(const css::frame::DispatchResult break; } m_bWaitingResult = false; - - aWriteLock.unlock(); - // <- SAFE ---------------------------------- } void SAL_CALL LoadEnvListener::disposing(const css::lang::EventObject&) throw(css::uno::RuntimeException, std::exception) { - // SAFE -> ---------------------------------- - Guard aWriteLock(m_aLock); - + osl::MutexGuard g(m_mutex); if (m_bWaitingResult) m_pLoadEnv->impl_setResult(sal_False); m_bWaitingResult = false; - - aWriteLock.unlock(); - // <- SAFE ---------------------------------- } commit 35c495fd78b0d59aef035273e49c174fdc05f407 Author: Stephan Bergmann <[email protected]> Date: Thu Mar 20 10:36:12 2014 +0100 Use an osl::Mutex directly Change-Id: I4db0fa34e00364e38ae015d079fee551be7319b3 diff --git a/framework/inc/services/dispatchhelper.hxx b/framework/inc/services/dispatchhelper.hxx index 922848c..5281713 100644 --- a/framework/inc/services/dispatchhelper.hxx +++ b/framework/inc/services/dispatchhelper.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX #define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX -#include <threadhelp/threadhelpbase.hxx> #include <macros/generic.hxx> #include <macros/xinterface.hxx> #include <macros/xtypeprovider.hxx> @@ -46,8 +45,7 @@ namespace framework{ All these steps are done inside one method call here. */ -class DispatchHelper : public ThreadHelpBase // must be the first base class! - ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener > +class DispatchHelper : public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener > { @@ -55,6 +53,8 @@ class DispatchHelper : public ThreadHelpBase // must be the private: + osl::Mutex m_mutex; + /** global uno service manager. Can be used to create own needed services. */ css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index f84ef5c..050885a 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -46,9 +46,7 @@ DEFINE_INIT_SERVICE( DispatchHelper, {} ) @param xSMGR the global uno service manager, which can be used to create own needed services. */ DispatchHelper::DispatchHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext ) - : ThreadHelpBase( ) - // Init member - , m_xContext (xContext) + : m_xContext (xContext) { } @@ -102,9 +100,9 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( // parse given URL /* SAFE { */ - Guard aReadLock(m_aLock); + osl::ClearableMutexGuard aReadLock(m_mutex); css::uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(m_xContext); - aReadLock.unlock(); + aReadLock.clear(); /* } SAFE */ css::util::URL aURL; @@ -129,11 +127,11 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( // Here we can hope for a result ... instead of the normal dispatch. css::uno::Reference< css::frame::XDispatchResultListener > xListener(xTHIS, css::uno::UNO_QUERY); /* SAFE { */ - Guard aWriteLock(m_aLock); + osl::ClearableMutexGuard aWriteLock(m_mutex); m_xBroadcaster = css::uno::Reference< css::uno::XInterface >(xNotifyDispatch, css::uno::UNO_QUERY); m_aResult = css::uno::Any(); m_aBlock.reset(); - aWriteLock.unlock(); + aWriteLock.clear(); /* } SAFE */ // dispatch it and wait for a notification @@ -164,14 +162,10 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( void SAL_CALL DispatchHelper::dispatchFinished( const css::frame::DispatchResultEvent& aResult ) throw(css::uno::RuntimeException, std::exception) { - /* SAFE { */ - Guard aWriteLock(m_aLock); - + osl::MutexGuard g(m_mutex); m_aResult <<= aResult; m_aBlock.set(); m_xBroadcaster.clear(); - - /* } SAFE */ } @@ -184,14 +178,10 @@ void SAL_CALL DispatchHelper::dispatchFinished( const css::frame::DispatchResult void SAL_CALL DispatchHelper::disposing( const css::lang::EventObject& ) throw(css::uno::RuntimeException, std::exception) { - /* SAFE { */ - Guard aWriteLock(m_aLock); - + osl::MutexGuard g(m_mutex); m_aResult.clear(); m_aBlock.set(); m_xBroadcaster.clear(); - - /* } SAFE */ } } commit 7f0a6e262f550a9eb4a29ef28818388c79778d8e Author: Stephan Bergmann <[email protected]> Date: Thu Mar 20 10:33:49 2014 +0100 Use an osl::Mutex directly Change-Id: I7131abdc2202f80f0e9600d04633bbd6078700bf diff --git a/framework/inc/uiconfiguration/globalsettings.hxx b/framework/inc/uiconfiguration/globalsettings.hxx index 7e738ec..b4809ad 100644 --- a/framework/inc/uiconfiguration/globalsettings.hxx +++ b/framework/inc/uiconfiguration/globalsettings.hxx @@ -27,7 +27,6 @@ #include <list> #include <boost/unordered_map.hpp> -#include <threadhelp/threadhelpbase.hxx> #include <macros/generic.hxx> #include <macros/xinterface.hxx> #include <macros/xtypeprovider.hxx> diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index 437234c..df20e46 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -18,7 +18,6 @@ */ #include "uiconfiguration/globalsettings.hxx" -#include <threadhelp/guard.hxx> #include "services.h" #include <com/sun/star/beans/PropertyValue.hpp> @@ -59,8 +58,7 @@ namespace framework // Configuration access class for WindowState supplier implementation -class GlobalSettings_Access : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public ::cppu::WeakImplHelper2< +class GlobalSettings_Access : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XComponent, ::com::sun::star::lang::XEventListener> { @@ -83,6 +81,7 @@ class GlobalSettings_Access : private ThreadHelpBase , private: sal_Bool impl_initConfigAccess(); + osl::Mutex m_mutex; sal_Bool m_bDisposed : 1, m_bConfigRead : 1; OUString m_aConfigSettingsAccess; @@ -98,7 +97,6 @@ class GlobalSettings_Access : private ThreadHelpBase , GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : - ThreadHelpBase(), m_bDisposed( sal_False ), m_bConfigRead( sal_False ), m_aConfigSettingsAccess( GLOBALSETTINGS_ROOT_ACCESS ), @@ -118,9 +116,7 @@ GlobalSettings_Access::~GlobalSettings_Access() void SAL_CALL GlobalSettings_Access::dispose() throw ( css::uno::RuntimeException, std::exception ) { - // SAFE - Guard aLock( m_aLock ); - + osl::MutexGuard g(m_mutex); m_xConfigAccess.clear(); m_bDisposed = sal_True; } @@ -139,15 +135,14 @@ throw (css::uno::RuntimeException, std::exception) void SAL_CALL GlobalSettings_Access::disposing( const css::lang::EventObject& ) throw (css::uno::RuntimeException, std::exception) { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); m_xConfigAccess.clear(); } // settings access sal_Bool GlobalSettings_Access::HasStatesInfo( GlobalSettings::UIElementType eElementType ) { - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); if ( eElementType == GlobalSettings::UIELEMENT_TYPE_DOCKWINDOW ) return sal_False; else if ( eElementType == GlobalSettings::UIELEMENT_TYPE_STATUSBAR ) @@ -185,7 +180,7 @@ sal_Bool GlobalSettings_Access::HasStatesInfo( GlobalSettings::UIElementType eEl sal_Bool GlobalSettings_Access::GetStateInfo( GlobalSettings::UIElementType eElementType, GlobalSettings::StateInfo eStateInfo, ::com::sun::star::uno::Any& aValue ) { - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); if ( eElementType == GlobalSettings::UIELEMENT_TYPE_DOCKWINDOW ) return sal_False; else if ( eElementType == GlobalSettings::UIELEMENT_TYPE_STATUSBAR ) commit da9aaab596ef4cd24f43902a047332971c92ffb2 Author: Stephan Bergmann <[email protected]> Date: Thu Mar 20 10:08:30 2014 +0100 Use an osl::Mutex directly Change-Id: Ia0a0dfae4390ad8cd74520396ecfbd6ac03a5d6f diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx index 6f3c8ed..4d7dc3d 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -19,7 +19,6 @@ #ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_FACTORYCONFIGURATION_HXX #define INCLUDED_FRAMEWORK_INC_UIFACTORY_FACTORYCONFIGURATION_HXX -#include <threadhelp/threadhelpbase.hxx> #include <macros/generic.hxx> #include <macros/xinterface.hxx> #include <macros/xtypeprovider.hxx> @@ -46,7 +45,6 @@ namespace framework // Configuration access class for PopupMenuControllerFactory implementation class ConfigurationAccess_ControllerFactory : // interfaces - private ThreadHelpBase, public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener> { public: @@ -91,6 +89,7 @@ private: sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, OUString& aCommand, OUString& aModule, OUString& aServiceSpecifier,OUString& aValue ) const; + mutable osl::Mutex m_mutex; OUString m_aPropCommand; OUString m_aPropModule; OUString m_aPropController; diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index 5320caa..0b2c2b1 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -18,7 +18,6 @@ */ #include "uifactory/factoryconfiguration.hxx" -#include <threadhelp/guard.hxx> #include "services.h" #include "helper/mischelper.hxx" @@ -60,7 +59,6 @@ OUString getHashKeyFromStrings( const OUString& aCommandURL, const OUString& aMo // XInterface, XTypeProvider ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( const Reference< XComponentContext >& rxContext, const OUString& _sRoot,bool _bAskValue ) : - ThreadHelpBase(), m_aPropCommand( "Command" ), m_aPropModule( "Module" ), m_aPropController( "Controller" ), @@ -74,8 +72,7 @@ ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( co ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory() { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY ); if ( xContainer.is() ) @@ -84,8 +81,7 @@ ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory() OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( const OUString& rCommandURL, const OUString& rModule ) const { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule )); if ( pIter != m_aMenuControllerMap.end() ) @@ -103,8 +99,7 @@ OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( con } OUString ConfigurationAccess_ControllerFactory::getValueFromCommandModule( const OUString& rCommandURL, const OUString& rModule ) const { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule )); @@ -128,8 +123,7 @@ void ConfigurationAccess_ControllerFactory::addServiceToCommandModule( const OUString& rModule, const OUString& rServiceSpecifier ) { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule ); m_aMenuControllerMap.insert( MenuControllerMap::value_type( aHashKey,ControllerInfo(rServiceSpecifier,OUString()) )); @@ -139,8 +133,7 @@ void ConfigurationAccess_ControllerFactory::removeServiceFromCommandModule( const OUString& rCommandURL, const OUString& rModule ) { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule ); m_aMenuControllerMap.erase( aHashKey ); @@ -154,8 +147,7 @@ void SAL_CALL ConfigurationAccess_ControllerFactory::elementInserted( const Cont OUString aService; OUString aValue; - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue )) { @@ -175,8 +167,7 @@ void SAL_CALL ConfigurationAccess_ControllerFactory::elementRemoved ( const Cont OUString aService; OUString aValue; - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue )) { @@ -195,16 +186,15 @@ void SAL_CALL ConfigurationAccess_ControllerFactory::elementReplaced( const Cont // lang.XEventListener void SAL_CALL ConfigurationAccess_ControllerFactory::disposing( const EventObject& ) throw(RuntimeException, std::exception) { - // SAFE // remove our reference to the config access - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); m_xConfigAccess.clear(); } void ConfigurationAccess_ControllerFactory::readConfigurationData() { // SAFE - Guard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_mutex ); if ( !m_bConfigAccessInitialized ) { @@ -233,7 +223,7 @@ void ConfigurationAccess_ControllerFactory::readConfigurationData() uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY ); // UNSAFE - aLock.unlock(); + aLock.clear(); if ( xContainer.is() ) { @@ -245,8 +235,7 @@ void ConfigurationAccess_ControllerFactory::readConfigurationData() void ConfigurationAccess_ControllerFactory::updateConfigurationData() { - // SAFE - Guard aLock( m_aLock ); + osl::MutexGuard g(m_mutex); if ( m_xConfigAccess.is() ) { Sequence< OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames(); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
