connectivity/source/simpledbt/dbtfactory.cxx | 3 desktop/source/app/app.cxx | 2 framework/Library_fwi.mk | 1 framework/inc/threadhelp/lockhelper.hxx | 39 ---------- framework/source/fwe/classes/actiontriggerpropertyset.cxx | 11 +- framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx | 11 +- framework/source/fwi/classes/protocolhandlercache.cxx | 27 +++--- framework/source/fwi/threadhelp/lockhelper.cxx | 37 --------- framework/source/helper/statusindicatorfactory.cxx | 11 +- framework/source/services/desktop.cxx | 9 +- framework/source/services/frame.cxx | 15 +-- include/connectivity/virtualdbtools.hxx | 5 + svx/source/form/dbtoolsclient.cxx | 10 +- svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx | 2 sw/source/core/uibase/dbui/swdbtoolsclient.cxx | 8 +- 15 files changed, 56 insertions(+), 135 deletions(-)
New commits: commit dc6175ff1fb317a4536722e2adb5302988316e9a Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Apr 15 12:50:57 2014 +0200 Remove LockHelper::getGlobalMutex(). Do what the TODO suggests - change it to SolarMutex in most cases. In some cases it is only there to guard a local static, introduce a local mutex for those. Change-Id: Idc3155818f737b958b36ee9125e2e9e8cb1b91a1 diff --git a/framework/Library_fwi.mk b/framework/Library_fwi.mk index 4c56b77..aaaf075 100644 --- a/framework/Library_fwi.mk +++ b/framework/Library_fwi.mk @@ -57,7 +57,6 @@ $(eval $(call gb_Library_add_exception_objects,fwi,\ framework/source/fwi/helper/shareablemutex \ framework/source/fwi/jobs/configaccess \ framework/source/fwi/jobs/jobconst \ - framework/source/fwi/threadhelp/lockhelper \ framework/source/fwi/threadhelp/transactionmanager \ framework/source/fwi/uielement/constitemcontainer \ framework/source/fwi/uielement/itemcontainer \ diff --git a/framework/inc/threadhelp/lockhelper.hxx b/framework/inc/threadhelp/lockhelper.hxx deleted file mode 100644 index eb2260a..0000000 --- a/framework/inc/threadhelp/lockhelper.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX -#define INCLUDED_FRAMEWORK_INC_THREADHELP_LOCKHELPER_HXX - -#include <sal/config.h> - -#include <fwidllapi.h> - -namespace osl { class Mutex; } - -namespace framework { namespace LockHelper { - -//TODO: This presumable should return the SolarMutex, though it actually returns -// some independent mutex: -FWI_DLLPUBLIC osl::Mutex & getGlobalLock(); - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx index 6c345d1..2176727 100644 --- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx +++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx @@ -18,7 +18,6 @@ */ #include <classes/actiontriggerpropertyset.hxx> -#include <threadhelp/lockhelper.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <cppuhelper/proptypehlp.hxx> #include <cppuhelper/supportsservice.hxx> @@ -199,7 +198,7 @@ void SAL_CALL ActionTriggerPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& aValue ) throw( Exception, std::exception ) { - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Search for right handle ... and try to set property value. switch( nHandle ) @@ -229,7 +228,7 @@ throw( Exception, std::exception ) void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue( Any& aValue, sal_Int32 nHandle ) const { - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Search for right handle ... and try to get property value. switch( nHandle ) @@ -265,8 +264,7 @@ void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue( if( pInfoHelper == NULL ) { - // Ready for multithreading - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Control this pointer again, another instance can be faster then these! if( pInfoHelper == NULL ) { @@ -291,8 +289,7 @@ throw ( RuntimeException, std::exception ) if( pInfo == NULL ) { - // Ready for multithreading - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Control this pointer again, another instance can be faster then these! if( pInfo == NULL ) { diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx index ba3ce6f..3090020 100644 --- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx +++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx @@ -18,7 +18,6 @@ */ #include <classes/actiontriggerseparatorpropertyset.hxx> -#include <threadhelp/lockhelper.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <cppuhelper/proptypehlp.hxx> #include <cppuhelper/supportsservice.hxx> @@ -176,7 +175,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::setFastPropertyValue_NoBroadcas sal_Int32 nHandle, const Any& aValue ) throw( Exception, std::exception ) { - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Search for right handle ... and try to set property value. switch( nHandle ) @@ -190,7 +189,7 @@ throw( Exception, std::exception ) void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue( Any& aValue, sal_Int32 nHandle ) const { - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Search for right handle ... and try to get property value. switch( nHandle ) @@ -210,8 +209,7 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue( if( pInfoHelper == NULL ) { - // Ready for multithreading - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Control this pointer again, another instance can be faster then these! if( pInfoHelper == NULL ) { @@ -236,8 +234,7 @@ throw ( RuntimeException, std::exception ) if( pInfo == NULL ) { - // Ready for multithreading - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; // Control this pointer again, another instance can be faster then these! if( pInfo == NULL ) { diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx index ff8e032..25e1973 100644 --- a/framework/source/fwi/classes/protocolhandlercache.cxx +++ b/framework/source/fwi/classes/protocolhandlercache.cxx @@ -25,11 +25,11 @@ #include <classes/protocolhandlercache.hxx> #include <classes/converter.hxx> -#include <threadhelp/lockhelper.hxx> #include <tools/wldcrd.hxx> #include <unotools/configpaths.hxx> #include <rtl/ustrbuf.hxx> +#include <vcl/svapp.hxx> namespace framework{ @@ -80,7 +80,7 @@ HandlerCFGAccess* HandlerCache::m_pConfig = NULL; */ HandlerCache::HandlerCache() { - osl::MutexGuard g(LockHelper::getGlobalLock()); + SolarMutexGuard aGuard; if (m_nRefCount==0) { @@ -101,7 +101,7 @@ HandlerCache::HandlerCache() */ HandlerCache::~HandlerCache() { - osl::MutexGuard g(LockHelper::getGlobalLock()); + SolarMutexGuard aGuard; if( m_nRefCount==1) { @@ -128,15 +128,16 @@ HandlerCache::~HandlerCache() bool HandlerCache::search( const OUString& sURL, ProtocolHandler* pReturn ) const { bool bFound = false; - /* SAFE */{ - osl::MutexGuard g(LockHelper::getGlobalLock()); - PatternHash::const_iterator pItem = m_pPattern->findPatternKey(sURL); - if (pItem!=m_pPattern->end()) - { - *pReturn = (*m_pHandler)[pItem->second]; - bFound = true; - } - /* SAFE */} + + SolarMutexGuard aGuard; + + PatternHash::const_iterator pItem = m_pPattern->findPatternKey(sURL); + if (pItem!=m_pPattern->end()) + { + *pReturn = (*m_pHandler)[pItem->second]; + bFound = true; + } + return bFound; } @@ -153,7 +154,7 @@ bool HandlerCache::search( const css::util::URL& aURL, ProtocolHandler* pReturn void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern) { - osl::MutexGuard g(LockHelper::getGlobalLock()); + SolarMutexGuard aGuard; HandlerHash* pOldHandler = m_pHandler; PatternHash* pOldPattern = m_pPattern; diff --git a/framework/source/fwi/threadhelp/lockhelper.cxx b/framework/source/fwi/threadhelp/lockhelper.cxx deleted file mode 100644 index 89a4a75..0000000 --- a/framework/source/fwi/threadhelp/lockhelper.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/config.h> - -#include <osl/mutex.hxx> -#include <rtl/instance.hxx> - -#include <threadhelp/lockhelper.hxx> - -namespace { - -struct GlobalLock: public rtl::Static<osl::Mutex, GlobalLock> {}; - -} - -osl::Mutex & framework::LockHelper::getGlobalLock() { - return GlobalLock::get(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index b1e10a5..f0544ce 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -21,7 +21,6 @@ #include <helper/statusindicatorfactory.hxx> #include <helper/statusindicator.hxx> #include <helper/vclstatusindicator.hxx> -#include <threadhelp/lockhelper.hxx> #include <services.h> #include <properties.h> @@ -49,7 +48,9 @@ namespace framework{ -sal_Int32 StatusIndicatorFactory::m_nInReschedule = 0; /// static counter for rescheduling +sal_Int32 StatusIndicatorFactory::m_nInReschedule = 0; ///< static counter for rescheduling +struct RescheduleLock: public rtl::Static<osl::Mutex, RescheduleLock> {}; ///< mutex to guard the m_nInReschedule + const char PROGRESS_RESOURCE[] = "private:resource/progressbar/progressbar"; StatusIndicatorFactory::StatusIndicatorFactory(const css::uno::Reference< css::uno::XComponentContext >& xContext) @@ -515,12 +516,12 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) return; // SAFE -> - osl::ResettableMutexGuard aGlobalLock(LockHelper::getGlobalLock()); + osl::ResettableMutexGuard aRescheduleGuard(RescheduleLock::get()); if (m_nInReschedule == 0) { ++m_nInReschedule; - aGlobalLock.clear(); + aRescheduleGuard.clear(); // <- SAFE { @@ -529,7 +530,7 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce) } // SAFE -> - aGlobalLock.reset(); + aRescheduleGuard.reset(); --m_nInReschedule; } } diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 49ff8a4..a624566 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -28,7 +28,6 @@ #include <dispatch/interceptionhelper.hxx> #include <classes/taskcreator.hxx> -#include <threadhelp/lockhelper.hxx> #include <threadhelp/transactionguard.hxx> #include <general.h> #include <properties.h> @@ -1449,8 +1448,8 @@ void SAL_CALL Desktop::getFastPropertyValue( css::uno::Any& aValue , if( pInfoHelper == NULL ) { - // Ready for multithreading - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; + // Control this pointer again, another instance can be faster then these! if( pInfoHelper == NULL ) { @@ -1493,8 +1492,8 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert if( pInfo == NULL ) { - // Ready for multithreading - ::osl::MutexGuard aGuard( LockHelper::getGlobalLock() ); + SolarMutexGuard aGuard; + // Control this pointer again, another instance can be faster then these! if( pInfo == NULL ) { diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index cea5080..c764808 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -32,7 +32,6 @@ #include <dispatch/dispatchinformationprovider.hxx> #include <classes/framecontainer.hxx> #include <classes/propertysethelper.hxx> -#include <threadhelp/lockhelper.hxx> #include <threadhelp/transactionguard.hxx> #include <threadhelp/transactionbase.hxx> #include <general.h> @@ -2507,6 +2506,7 @@ void SAL_CALL Frame::windowClosing( const css::lang::EventObject& ) throw( css:: void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno::RuntimeException, std::exception) { static bool bFirstVisibleTask = true; + static osl::Mutex aFirstVisibleLock; /* SAFE { */ SolarMutexClearableGuard aReadLock; @@ -2520,12 +2520,10 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno if (xDesktopCheck.is()) { - /* STATIC SAFE { */ - osl::ClearableMutexGuard aStaticWriteLock( LockHelper::getGlobalLock() ); - bool bMustBeTriggered = bFirstVisibleTask; - bFirstVisibleTask = false; - aStaticWriteLock.clear(); - /* } STATIC SAFE */ + osl::ClearableMutexGuard aGuard(aFirstVisibleLock); + bool bMustBeTriggered = bFirstVisibleTask; + bFirstVisibleTask = false; + aGuard.clear(); if (bMustBeTriggered) { @@ -3216,7 +3214,8 @@ void Frame::impl_checkMenuCloser() // Look for necessary actions ... // Only if the closer state must be moved from one frame to another one // or must be enabled/disabled at all. - osl::MutexGuard g(LockHelper::getGlobalLock()); + SolarMutexGuard aGuard; + css::uno::Reference< css::frame::XFrame2 > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY); if (xCloserFrame!=xNewCloserFrame) { commit 4bc0bd734847160d3eb94d9e49d9b99f2c7c1afc Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Apr 15 12:18:34 2014 +0200 non-desktop: Avoid dbaccess. Change-Id: I4cabda76917cded05a2978b1a280775b7f77a0de diff --git a/connectivity/source/simpledbt/dbtfactory.cxx b/connectivity/source/simpledbt/dbtfactory.cxx index 2f8d2fc..5211b76 100644 --- a/connectivity/source/simpledbt/dbtfactory.cxx +++ b/connectivity/source/simpledbt/dbtfactory.cxx @@ -30,13 +30,14 @@ using namespace ::com::sun::star::lang; // the entry point for load-on-call usage of the DBTOOLS lib +#if HAVE_FEATURE_DESKTOP extern "C" void* SAL_CALL createDataAccessToolsFactory() { ::connectivity::ODataAccessToolsFactory* pFactory = new ::connectivity::ODataAccessToolsFactory; pFactory->acquire(); return pFactory; } - +#endif namespace connectivity { diff --git a/include/connectivity/virtualdbtools.hxx b/include/connectivity/virtualdbtools.hxx index 332ac8c..8474dc4 100644 --- a/include/connectivity/virtualdbtools.hxx +++ b/include/connectivity/virtualdbtools.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_CONNECTIVITY_VIRTUALDBTOOLS_HXX #define INCLUDED_CONNECTIVITY_VIRTUALDBTOOLS_HXX +#include <config_features.h> + #include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -88,8 +90,9 @@ namespace dbtools { a pointer to an object implementing the IDataAccessToolsFactory interface, aquired exactly <em>once</em>. */ +#if HAVE_FEATURE_DESKTOP extern "C" OOO_DLLPUBLIC_DBTOOLS void* SAL_CALL createDataAccessToolsFactory(); - +#endif //= diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx index 4d6c659..eabf90a 100644 --- a/svx/source/form/dbtoolsclient.cxx +++ b/svx/source/form/dbtoolsclient.cxx @@ -95,16 +95,12 @@ namespace svxform revokeClient(); } - - +#if HAVE_FEATURE_DESKTOP #ifndef DISABLE_DYNLOADING - extern "C" { static void SAL_CALL thisModule() {} } - #else - extern "C" void * createDataAccessToolsFactory(); - +#endif #endif void ODbtoolsClient::registerClient() @@ -115,6 +111,7 @@ namespace svxform OSL_ENSURE(NULL == s_hDbtoolsModule, "ODbtoolsClient::registerClient: inconsistence: already have a module!"); OSL_ENSURE(NULL == s_pFactoryCreationFunc, "ODbtoolsClient::registerClient: inconsistence: already have a factory function!"); +#if HAVE_FEATURE_DESKTOP #ifndef DISABLE_DYNLOADING const OUString sModuleName( SVLIBRARY( "dbtools" ) ); @@ -141,6 +138,7 @@ namespace svxform #else s_pFactoryCreationFunc = createDataAccessToolsFactory; #endif +#endif } } diff --git a/sw/source/core/uibase/dbui/swdbtoolsclient.cxx b/sw/source/core/uibase/dbui/swdbtoolsclient.cxx index 9fdc6a3..f1bde42 100644 --- a/sw/source/core/uibase/dbui/swdbtoolsclient.cxx +++ b/sw/source/core/uibase/dbui/swdbtoolsclient.cxx @@ -84,14 +84,12 @@ SwDbtoolsClient::~SwDbtoolsClient() } } +#if HAVE_FEATURE_DESKTOP #ifndef DISABLE_DYNLOADING - extern "C" { static void SAL_CALL thisModule() {} } - #else - extern "C" void * createDataAccessToolsFactory(); - +#endif #endif void SwDbtoolsClient::registerClient() @@ -102,6 +100,7 @@ void SwDbtoolsClient::registerClient() OSL_ENSURE(NULL == getDbToolsClientModule(), "SwDbtoolsClient::registerClient: inconsistence: already have a module!"); OSL_ENSURE(NULL == getDbToolsClientFactoryFunction(), "SwDbtoolsClient::registerClient: inconsistence: already have a factory function!"); +#if HAVE_FEATURE_DESKTOP #ifndef DISABLE_DYNLOADING const OUString sModuleName(SVLIBRARY("dbtools")); @@ -127,6 +126,7 @@ void SwDbtoolsClient::registerClient() #else getDbToolsClientFactoryFunction() = createDataAccessToolsFactory; #endif +#endif } } commit 048d27bae87f2a39a0fc853e32b474ab58e92dde Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Apr 15 11:41:23 2014 +0200 non-desktop: Don't even attempt to create a lockfile. Change-Id: I68a4cf8f2e302b49e3d2719ee2bad3f823e8a036 diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 75c9cf2..518c694 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1422,12 +1422,12 @@ int Desktop::Main() SetSplashScreenProgress(25); +#if HAVE_FEATURE_DESKTOP // check user installation directory for lockfile so we can be sure // there is no other instance using our data files from a remote host SAL_INFO( "desktop.app", "desktop (lo119109) Desktop::Main -> Lockfile" ); m_xLockfile.reset(new Lockfile); -#if HAVE_FEATURE_DESKTOP if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsNoLockcheck() && !m_xLockfile->check( Lockfile_execWarning )) { commit 6b7e0c7a9fc0c4e1a58b43204ee385397d8f21bf Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Apr 15 11:31:06 2014 +0200 non-desktop: Avoid pulling in avmedia. Change-Id: Ie4a6a4ddb1615f917bccfb68b20cc1ac7587a2ca diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx index 429ebbe..6881664 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx @@ -43,6 +43,7 @@ ViewObjectContactOfSdrMediaObj::ViewObjectContactOfSdrMediaObj( ObjectContact& r ViewObjectContactOfSdrObj( rObjectContact, rViewContact ), mpMediaWindow( NULL ) { +#if HAVE_FEATURE_DESKTOP Window* pWindow = getWindow(); if( pWindow ) @@ -51,6 +52,7 @@ ViewObjectContactOfSdrMediaObj::ViewObjectContactOfSdrMediaObj( ObjectContact& r mpMediaWindow->hide(); executeMediaItem( rMediaItem ); } +#endif } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits