stoc: replace double-checked locking with static initializers
Change-Id: I2a36033d0377a58dc27564e903e2c7ce02696206 Reviewed-on: https://gerrit.libreoffice.org/55900 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
This commit is contained in:
@@ -52,19 +52,11 @@ void ArrayIdlClassImpl::release() throw()
|
|||||||
|
|
||||||
Sequence< Type > ArrayIdlClassImpl::getTypes()
|
Sequence< Type > ArrayIdlClassImpl::getTypes()
|
||||||
{
|
{
|
||||||
static ::cppu::OTypeCollection * s_pTypes = nullptr;
|
static cppu::OTypeCollection s_aTypes(
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
::osl::MutexGuard aGuard( getMutexAccess() );
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
static ::cppu::OTypeCollection s_aTypes(
|
|
||||||
cppu::UnoType<XIdlArray>::get(),
|
cppu::UnoType<XIdlArray>::get(),
|
||||||
IdlClassImpl::getTypes() );
|
IdlClassImpl::getTypes() );
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
return s_aTypes.getTypes();
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > ArrayIdlClassImpl::getImplementationId()
|
Sequence< sal_Int8 > ArrayIdlClassImpl::getImplementationId()
|
||||||
|
@@ -35,17 +35,9 @@ ClassNameVector g_aClassNames;
|
|||||||
|
|
||||||
::osl::Mutex & getMutexAccess()
|
::osl::Mutex & getMutexAccess()
|
||||||
{
|
{
|
||||||
static ::osl::Mutex * s_pMutex = nullptr;
|
static osl::Mutex s_aMutex;
|
||||||
if (! s_pMutex)
|
|
||||||
{
|
return s_aMutex;
|
||||||
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
|
||||||
if (! s_pMutex)
|
|
||||||
{
|
|
||||||
static ::osl::Mutex s_aMutex;
|
|
||||||
s_pMutex = &s_aMutex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *s_pMutex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -94,20 +94,12 @@ void IdlCompFieldImpl::release() throw()
|
|||||||
|
|
||||||
Sequence< Type > IdlCompFieldImpl::getTypes()
|
Sequence< Type > IdlCompFieldImpl::getTypes()
|
||||||
{
|
{
|
||||||
static ::cppu::OTypeCollection * s_pTypes = nullptr;
|
static cppu::OTypeCollection s_aTypes(
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
::osl::MutexGuard aGuard( getMutexAccess() );
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
static ::cppu::OTypeCollection s_aTypes(
|
|
||||||
cppu::UnoType<XIdlField2>::get(),
|
cppu::UnoType<XIdlField2>::get(),
|
||||||
cppu::UnoType<XIdlField>::get(),
|
cppu::UnoType<XIdlField>::get(),
|
||||||
IdlMemberImpl::getTypes() );
|
IdlMemberImpl::getTypes() );
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
return s_aTypes.getTypes();
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > IdlCompFieldImpl::getImplementationId()
|
Sequence< sal_Int8 > IdlCompFieldImpl::getImplementationId()
|
||||||
|
@@ -81,22 +81,14 @@ void IdlReflectionServiceImpl::release() throw()
|
|||||||
// XTypeProvider
|
// XTypeProvider
|
||||||
|
|
||||||
Sequence< Type > IdlReflectionServiceImpl::getTypes()
|
Sequence< Type > IdlReflectionServiceImpl::getTypes()
|
||||||
{
|
|
||||||
static OTypeCollection * s_pTypes = nullptr;
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
MutexGuard aGuard( _aComponentMutex );
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
{
|
||||||
static OTypeCollection s_aTypes(
|
static OTypeCollection s_aTypes(
|
||||||
cppu::UnoType<XIdlReflection>::get(),
|
cppu::UnoType<XIdlReflection>::get(),
|
||||||
cppu::UnoType<XHierarchicalNameAccess>::get(),
|
cppu::UnoType<XHierarchicalNameAccess>::get(),
|
||||||
cppu::UnoType<XServiceInfo>::get(),
|
cppu::UnoType<XServiceInfo>::get(),
|
||||||
OComponentHelper::getTypes() );
|
OComponentHelper::getTypes() );
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
return s_aTypes.getTypes();
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > IdlReflectionServiceImpl::getImplementationId()
|
Sequence< sal_Int8 > IdlReflectionServiceImpl::getImplementationId()
|
||||||
|
@@ -88,20 +88,12 @@ void IdlEnumFieldImpl::release() throw()
|
|||||||
|
|
||||||
Sequence< Type > IdlEnumFieldImpl::getTypes()
|
Sequence< Type > IdlEnumFieldImpl::getTypes()
|
||||||
{
|
{
|
||||||
static ::cppu::OTypeCollection * s_pTypes = nullptr;
|
static cppu::OTypeCollection s_aTypes(
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
::osl::MutexGuard aGuard( getMutexAccess() );
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
static ::cppu::OTypeCollection s_aTypes(
|
|
||||||
cppu::UnoType<XIdlField2>::get(),
|
cppu::UnoType<XIdlField2>::get(),
|
||||||
cppu::UnoType<XIdlField>::get(),
|
cppu::UnoType<XIdlField>::get(),
|
||||||
IdlMemberImpl::getTypes() );
|
IdlMemberImpl::getTypes() );
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
return s_aTypes.getTypes();
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > IdlEnumFieldImpl::getImplementationId()
|
Sequence< sal_Int8 > IdlEnumFieldImpl::getImplementationId()
|
||||||
|
@@ -121,20 +121,12 @@ void IdlAttributeFieldImpl::release() throw()
|
|||||||
|
|
||||||
Sequence< Type > IdlAttributeFieldImpl::getTypes()
|
Sequence< Type > IdlAttributeFieldImpl::getTypes()
|
||||||
{
|
{
|
||||||
static ::cppu::OTypeCollection * s_pTypes = nullptr;
|
static cppu::OTypeCollection s_aTypes(
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
::osl::MutexGuard aGuard( getMutexAccess() );
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
static ::cppu::OTypeCollection s_aTypes(
|
|
||||||
cppu::UnoType<XIdlField2>::get(),
|
cppu::UnoType<XIdlField2>::get(),
|
||||||
cppu::UnoType<XIdlField>::get(),
|
cppu::UnoType<XIdlField>::get(),
|
||||||
IdlMemberImpl::getTypes() );
|
IdlMemberImpl::getTypes() );
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
return s_aTypes.getTypes();
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > IdlAttributeFieldImpl::getImplementationId()
|
Sequence< sal_Int8 > IdlAttributeFieldImpl::getImplementationId()
|
||||||
@@ -383,19 +375,11 @@ void IdlInterfaceMethodImpl::release() throw()
|
|||||||
|
|
||||||
Sequence< Type > IdlInterfaceMethodImpl::getTypes()
|
Sequence< Type > IdlInterfaceMethodImpl::getTypes()
|
||||||
{
|
{
|
||||||
static ::cppu::OTypeCollection * s_pTypes = nullptr;
|
static cppu::OTypeCollection s_aTypes(
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
::osl::MutexGuard aGuard( getMutexAccess() );
|
|
||||||
if (! s_pTypes)
|
|
||||||
{
|
|
||||||
static ::cppu::OTypeCollection s_aTypes(
|
|
||||||
cppu::UnoType<XIdlMethod>::get(),
|
cppu::UnoType<XIdlMethod>::get(),
|
||||||
IdlMemberImpl::getTypes() );
|
IdlMemberImpl::getTypes() );
|
||||||
s_pTypes = &s_aTypes;
|
|
||||||
}
|
return s_aTypes.getTypes();
|
||||||
}
|
|
||||||
return s_pTypes->getTypes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > IdlInterfaceMethodImpl::getImplementationId()
|
Sequence< sal_Int8 > IdlInterfaceMethodImpl::getImplementationId()
|
||||||
|
@@ -99,17 +99,9 @@ struct StringPool
|
|||||||
|
|
||||||
const StringPool &spool()
|
const StringPool &spool()
|
||||||
{
|
{
|
||||||
static StringPool *pPool = nullptr;
|
static StringPool s_pool;
|
||||||
if( ! pPool )
|
|
||||||
{
|
return s_pool;
|
||||||
MutexGuard guard( Mutex::getGlobalMutex() );
|
|
||||||
if( ! pPool )
|
|
||||||
{
|
|
||||||
static StringPool pool;
|
|
||||||
pPool = &pool;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *pPool;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user