framework: replace double checked locking patterns
with thread safe local statics. Change-Id: I660f6a899d1821bab627ed4972c4fc0d40610de2 Reviewed-on: https://gerrit.libreoffice.org/38541 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
93d6a7ca51
commit
e4f6840d09
@@ -25,7 +25,6 @@
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <com/sun/star/uno/Type.hxx>
|
||||
#include <cppuhelper/typeprovider.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
|
||||
namespace framework{
|
||||
|
||||
@@ -73,31 +72,13 @@ ________________________________________________________________________________
|
||||
// private
|
||||
// complete implementation of XTypeProvider with max. 12 interfaces!
|
||||
|
||||
#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \
|
||||
PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \
|
||||
#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \
|
||||
PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \
|
||||
css::uno::Sequence< css::uno::Type > SAL_CALL CLASS::getTypes() \
|
||||
{ \
|
||||
/* Optimize this method ! */ \
|
||||
/* We initialize a static variable only one time. */ \
|
||||
/* And we don't must use a mutex at every call! */ \
|
||||
/* For the first call; pTypeCollection is NULL - */ \
|
||||
/* for the second call pTypeCollection is different from NULL! */ \
|
||||
static ::cppu::OTypeCollection* pTypeCollection = nullptr; \
|
||||
if ( pTypeCollection == nullptr ) \
|
||||
{ \
|
||||
/* Ready for multithreading; get global mutex for first call of this method only! see before */ \
|
||||
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
|
||||
/* Control these pointer again ... it can be, that another instance will be faster then these! */ \
|
||||
if ( pTypeCollection == nullptr ) \
|
||||
{ \
|
||||
/* Create a static typecollection ... */ \
|
||||
/* Attention: "TYPES" will expand to "(...)"! */ \
|
||||
static ::cppu::OTypeCollection aTypeCollection TYPES; \
|
||||
/* ... and set his address to static pointer! */ \
|
||||
pTypeCollection = &aTypeCollection; \
|
||||
} \
|
||||
} \
|
||||
return pTypeCollection->getTypes(); \
|
||||
{ \
|
||||
/* Attention: "TYPES" will expand to "(...)"! */ \
|
||||
static cppu::OTypeCollection ourTypeCollection TYPES; \
|
||||
return ourTypeCollection.getTypes(); \
|
||||
}
|
||||
|
||||
// public
|
||||
|
@@ -117,32 +117,14 @@ Sequence< OUString > SAL_CALL ActionTriggerContainer::getSupportedServiceNames()
|
||||
// XTypeProvider
|
||||
Sequence< Type > SAL_CALL ActionTriggerContainer::getTypes()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
|
||||
static ::cppu::OTypeCollection* pTypeCollection = nullptr;
|
||||
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Ready for multithreading; get global mutex for first call of this method only! see before
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control these pointer again ... it can be, that another instance will be faster then these!
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection aTypeCollection(
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection ourTypeCollection(
|
||||
cppu::UnoType<XMultiServiceFactory>::get(),
|
||||
cppu::UnoType<XIndexContainer>::get(),
|
||||
cppu::UnoType<XServiceInfo>::get(),
|
||||
cppu::UnoType<XTypeProvider>::get());
|
||||
|
||||
// ... and set his address to static pointer!
|
||||
pTypeCollection = &aTypeCollection;
|
||||
}
|
||||
}
|
||||
|
||||
return pTypeCollection->getTypes();
|
||||
return ourTypeCollection.getTypes();
|
||||
}
|
||||
|
||||
Sequence< sal_Int8 > SAL_CALL ActionTriggerContainer::getImplementationId()
|
||||
|
@@ -115,33 +115,16 @@ Sequence< OUString > SAL_CALL ActionTriggerPropertySet::getSupportedServiceNames
|
||||
// XTypeProvider
|
||||
Sequence< Type > SAL_CALL ActionTriggerPropertySet::getTypes()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
|
||||
static ::cppu::OTypeCollection* pTypeCollection = nullptr;
|
||||
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Ready for multithreading; get global mutex for first call of this method only! see before
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control these pointer again ... it can be, that another instance will be faster then these!
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection aTypeCollection(
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection ourTypeCollection(
|
||||
cppu::UnoType<XPropertySet>::get(),
|
||||
cppu::UnoType<XFastPropertySet>::get(),
|
||||
cppu::UnoType<XMultiPropertySet>::get(),
|
||||
cppu::UnoType<XServiceInfo>::get(),
|
||||
cppu::UnoType<XTypeProvider>::get());
|
||||
|
||||
// ... and set his address to static pointer!
|
||||
pTypeCollection = &aTypeCollection;
|
||||
}
|
||||
}
|
||||
|
||||
return pTypeCollection->getTypes();
|
||||
return ourTypeCollection.getTypes();
|
||||
}
|
||||
|
||||
Sequence< sal_Int8 > SAL_CALL ActionTriggerPropertySet::getImplementationId()
|
||||
@@ -251,49 +234,21 @@ void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue(
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL ActionTriggerPropertySet::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "true" say: Table is sorted by name.
|
||||
static OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
Reference< XPropertySetInfo > SAL_CALL ActionTriggerPropertySet::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static Reference< XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
const Sequence< Property > ActionTriggerPropertySet::impl_getStaticPropertyDescriptor()
|
||||
|
@@ -108,33 +108,15 @@ Sequence< OUString > SAL_CALL ActionTriggerSeparatorPropertySet::getSupportedSer
|
||||
// XTypeProvider
|
||||
Sequence< Type > SAL_CALL ActionTriggerSeparatorPropertySet::getTypes()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
|
||||
static ::cppu::OTypeCollection* pTypeCollection = nullptr;
|
||||
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Ready for multithreading; get global mutex for first call of this method only! see before
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control these pointer again ... it can be, that another instance will be faster then these!
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection aTypeCollection(
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection ourTypeCollection(
|
||||
cppu::UnoType<XPropertySet>::get(),
|
||||
cppu::UnoType<XFastPropertySet>::get(),
|
||||
cppu::UnoType<XMultiPropertySet>::get(),
|
||||
cppu::UnoType<XServiceInfo>::get(),
|
||||
cppu::UnoType<XTypeProvider>::get());
|
||||
|
||||
// ... and set his address to static pointer!
|
||||
pTypeCollection = &aTypeCollection;
|
||||
}
|
||||
}
|
||||
|
||||
return pTypeCollection->getTypes();
|
||||
return ourTypeCollection.getTypes();
|
||||
}
|
||||
|
||||
Sequence< sal_Int8 > SAL_CALL ActionTriggerSeparatorPropertySet::getImplementationId()
|
||||
@@ -196,49 +178,21 @@ void SAL_CALL ActionTriggerSeparatorPropertySet::getFastPropertyValue(
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL ActionTriggerSeparatorPropertySet::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "rrue" say: Table is sorted by name.
|
||||
static OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
Reference< XPropertySetInfo > SAL_CALL ActionTriggerSeparatorPropertySet::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static Reference< XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
const Sequence< Property > ActionTriggerSeparatorPropertySet::impl_getStaticPropertyDescriptor()
|
||||
|
@@ -1594,24 +1594,10 @@ Image AddonsOptions::GetImageFromURL( const OUString& aURL, bool bBig ) const
|
||||
|
||||
Mutex& AddonsOptions::GetOwnStaticMutex()
|
||||
{
|
||||
// Initialize static mutex only for one time!
|
||||
static Mutex* pMutex = nullptr;
|
||||
// If these method first called (Mutex not already exist!) ...
|
||||
if( pMutex == nullptr )
|
||||
{
|
||||
// ... we must create a new one. Protect follow code with the global mutex -
|
||||
// It must be - we create a static variable!
|
||||
MutexGuard aGuard( Mutex::getGlobalMutex() );
|
||||
// We must check our pointer again - because it can be that another instance of our class will be faster than these!
|
||||
if( pMutex == nullptr )
|
||||
{
|
||||
// Create the new mutex and set it for return on static variable.
|
||||
static Mutex aMutex;
|
||||
pMutex = &aMutex;
|
||||
}
|
||||
}
|
||||
// Return new created or already existing mutex object.
|
||||
return *pMutex;
|
||||
// Create static mutex variable.
|
||||
static Mutex ourMutex;
|
||||
|
||||
return ourMutex;
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(AddonsOptions_Impl, NotifyEvent, void*, void)
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <cppuhelper/queryinterface.hxx>
|
||||
#include <cppuhelper/typeprovider.hxx>
|
||||
#include <framework/actiontriggerhelper.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
using namespace cppu;
|
||||
@@ -231,21 +230,8 @@ sal_Int64 SAL_CALL RootActionTriggerContainer::getSomething( const Sequence< sal
|
||||
// XTypeProvider
|
||||
Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
|
||||
static ::cppu::OTypeCollection* pTypeCollection = nullptr;
|
||||
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Ready for multithreading; get global mutex for first call of this method only! see before
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control these pointer again ... it can be, that another instance will be faster then these!
|
||||
if ( pTypeCollection == nullptr )
|
||||
{
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection aTypeCollection(
|
||||
// Create a static typecollection ...
|
||||
static ::cppu::OTypeCollection ourTypeCollection(
|
||||
cppu::UnoType<XMultiServiceFactory>::get(),
|
||||
cppu::UnoType<XIndexContainer>::get(),
|
||||
cppu::UnoType<XServiceInfo>::get(),
|
||||
@@ -253,12 +239,7 @@ Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes()
|
||||
cppu::UnoType<XUnoTunnel>::get(),
|
||||
cppu::UnoType<XNamed>::get());
|
||||
|
||||
// ... and set his address to static pointer!
|
||||
pTypeCollection = &aTypeCollection;
|
||||
}
|
||||
}
|
||||
|
||||
return pTypeCollection->getTypes();
|
||||
return ourTypeCollection.getTypes();
|
||||
}
|
||||
|
||||
Sequence< sal_Int8 > SAL_CALL RootActionTriggerContainer::getImplementationId()
|
||||
|
@@ -213,26 +213,11 @@ Any SAL_CALL ConstItemContainer::getByIndex( sal_Int32 Index )
|
||||
// XPropertySet
|
||||
Reference< XPropertySetInfo > SAL_CALL ConstItemContainer::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static Reference< XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static Reference< XPropertySetInfo > xInfo(new comphelper::PropertySetInfo(getInfoHelper().getProperties()));
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static Reference< XPropertySetInfo > xInfo = new ::comphelper::PropertySetInfo(getInfoHelper().getProperties());
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
void SAL_CALL ConstItemContainer::setPropertyValue( const OUString&, const Any& )
|
||||
@@ -281,28 +266,12 @@ Any SAL_CALL ConstItemContainer::getFastPropertyValue( sal_Int32 nHandle )
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL ConstItemContainer::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "true" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return(*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
const css::uno::Sequence< css::beans::Property > ConstItemContainer::impl_getStaticPropertyDescriptor()
|
||||
|
@@ -295,52 +295,21 @@ void SAL_CALL RootItemContainer::getFastPropertyValue( css::uno::Any& aValue ,
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL RootItemContainer::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "true" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return(*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL RootItemContainer::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
const css::uno::Sequence< css::beans::Property > RootItemContainer::impl_getStaticPropertyDescriptor()
|
||||
|
@@ -373,52 +373,21 @@ void SAL_CALL UIConfigElementWrapperBase::getFastPropertyValue( css::uno::Any& a
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL UIConfigElementWrapperBase::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "true" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return(*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL UIConfigElementWrapperBase::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
const css::uno::Sequence< css::beans::Property > UIConfigElementWrapperBase::impl_getStaticPropertyDescriptor()
|
||||
|
@@ -168,52 +168,21 @@ void SAL_CALL UIElementWrapperBase::getFastPropertyValue( css::uno::Any& aValue
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL UIElementWrapperBase::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "true" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return(*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL UIElementWrapperBase::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
const css::uno::Sequence< css::beans::Property > UIElementWrapperBase::impl_getStaticPropertyDescriptor()
|
||||
|
@@ -3109,20 +3109,9 @@ namespace
|
||||
|
||||
uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo()
|
||||
{
|
||||
static uno::Reference< beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
} // namespace framework
|
||||
|
@@ -4024,35 +4024,17 @@ const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescripto
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL AutoRecovery::getInfoHelper()
|
||||
{
|
||||
static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
if(!pInfoHelper)
|
||||
{
|
||||
SolarMutexGuard g;
|
||||
if(!pInfoHelper)
|
||||
{
|
||||
static ::cppu::OPropertyArrayHelper aInfoHelper(impl_getStaticPropertyDescriptor(), true);
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
static ::cppu::OPropertyArrayHelper ourInfoHelper(impl_getStaticPropertyDescriptor(), true);
|
||||
|
||||
return (*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL AutoRecovery::getPropertySetInfo()
|
||||
{
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
if(!pInfo)
|
||||
{
|
||||
SolarMutexGuard g;
|
||||
if(!pInfo)
|
||||
{
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
|
||||
::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()));
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList()
|
||||
|
@@ -1507,27 +1507,12 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert
|
||||
// Register transaction and reject wrong calls.
|
||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
||||
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
|
||||
cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
/*-************************************************************************************************************
|
||||
|
@@ -818,52 +818,21 @@ void SAL_CALL TabWindow::getFastPropertyValue( css::uno::Any& aValue ,
|
||||
|
||||
::cppu::IPropertyArrayHelper& SAL_CALL TabWindow::getInfoHelper()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
|
||||
static ::cppu::OPropertyArrayHelper* pInfoHelper = nullptr;
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "true" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper ourInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfoHelper == nullptr )
|
||||
{
|
||||
// Define static member to give structure of properties to baseclass "OPropertySetHelper".
|
||||
// "impl_getStaticPropertyDescriptor" is a non exported and static function, who will define a static propertytable.
|
||||
// "sal_True" say: Table is sorted by name.
|
||||
static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), true );
|
||||
pInfoHelper = &aInfoHelper;
|
||||
}
|
||||
}
|
||||
|
||||
return(*pInfoHelper);
|
||||
return ourInfoHelper;
|
||||
}
|
||||
|
||||
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL TabWindow::getPropertySetInfo()
|
||||
{
|
||||
// Optimize this method !
|
||||
// We initialize a static variable only one time. And we don't must use a mutex at every call!
|
||||
// For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo >* pInfo = nullptr;
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Ready for multithreading
|
||||
osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() );
|
||||
// Control this pointer again, another instance can be faster then these!
|
||||
if( pInfo == nullptr )
|
||||
{
|
||||
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
|
||||
// (Use method "getInfoHelper()".)
|
||||
static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
pInfo = &xInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return (*pInfo);
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
const css::uno::Sequence< css::beans::Property > TabWindow::impl_getStaticPropertyDescriptor()
|
||||
|
Reference in New Issue
Block a user