summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/tdoc
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-06-06 11:02:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-06 20:58:18 +0200
commitcbcaff7510d557d345c15db97f52633c81939d41 (patch)
tree745ebaa1a384a290bd408288f542e356a20f9027 /ucb/source/ucp/tdoc
parentca8a4a7abc81a53a88fc0daa61447f9562f532f5 (diff)
ucb: replace double checked locking patterns
with thread safe local statics and prefix statics Change-Id: Iaa7c9056847f75612d6cf6c6e44d3896fca734de Reviewed-on: https://gerrit.libreoffice.org/38433 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source/ucp/tdoc')
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.cxx51
-rw-r--r--ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx14
2 files changed, 10 insertions, 55 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx
index 60bfdc12db2f..ec53ad152588 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.cxx
@@ -25,7 +25,6 @@
*************************************************************************/
#include "osl/diagnose.h"
-#include "osl/doublecheckedlocking.h"
#include "rtl/ustrbuf.hxx"
#include "com/sun/star/beans/IllegalTypeException.hpp"
#include "com/sun/star/beans/PropertyAttribute.hpp"
@@ -216,21 +215,9 @@ XTYPEPROVIDER_COMMON_IMPL( Content );
// virtual
uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
{
- cppu::OTypeCollection * pCollection = nullptr;
-
if ( m_aProps.isContentCreator() )
{
- static cppu::OTypeCollection* pFolderTypes = nullptr;
-
- pCollection = pFolderTypes;
- if ( !pCollection )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
- pCollection = pFolderTypes;
- if ( !pCollection )
- {
- static cppu::OTypeCollection aCollection(
+ static cppu::OTypeCollection s_aFolderTypes(
CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -241,29 +228,13 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
CPPU_TYPE_REF( beans::XPropertyContainer ),
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ),
- CPPU_TYPE_REF( ucb::XContentCreator ) ); // !!
- pCollection = &aCollection;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- pFolderTypes = pCollection;
- }
- }
- else {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
+ CPPU_TYPE_REF( ucb::XContentCreator ) );
+
+ return s_aFolderTypes.getTypes();
}
else
{
- static cppu::OTypeCollection* pDocumentTypes = nullptr;
-
- pCollection = pDocumentTypes;
- if ( !pCollection )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
- pCollection = pDocumentTypes;
- if ( !pCollection )
- {
- static cppu::OTypeCollection aCollection(
+ static cppu::OTypeCollection s_aDocumentTypes(
CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -274,17 +245,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
CPPU_TYPE_REF( beans::XPropertyContainer ),
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ) );
- pCollection = &aCollection;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- pDocumentTypes = pCollection;
- }
- }
- else {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
- }
- return (*pCollection).getTypes();
+ return s_aDocumentTypes.getTypes();
+ }
}
diff --git a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx
index 439f60df4b34..d3690722c641 100644
--- a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx
@@ -118,19 +118,11 @@ InteractionSupplyPassword::getImplementationId()
// virtual
uno::Sequence< uno::Type > SAL_CALL InteractionSupplyPassword::getTypes()
{
- static cppu::OTypeCollection * pCollection = nullptr;
- if ( !pCollection )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
- if ( !pCollection )
- {
- static cppu::OTypeCollection collection(
+ static cppu::OTypeCollection s_aCollection(
cppu::UnoType<lang::XTypeProvider>::get(),
cppu::UnoType<task::XInteractionPassword>::get() );
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
+
+ return s_aCollection.getTypes();
}