summaryrefslogtreecommitdiff
path: root/ucb
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
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')
-rw-r--r--ucb/source/core/provprox.cxx4
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx8
-rw-r--r--ucb/source/ucp/cmis/cmis_repo_content.cxx4
-rw-r--r--ucb/source/ucp/file/filid.cxx13
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx14
-rw-r--r--ucb/source/ucp/ftp/ftpcontentidentifier.cxx13
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx14
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx9
-rw-r--r--ucb/source/ucp/hierarchy/hierarchycontent.cxx52
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.cxx49
-rw-r--r--ucb/source/ucp/package/pkgcontent.cxx52
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.cxx51
-rw-r--r--ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx14
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx51
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.cxx51
15 files changed, 71 insertions, 328 deletions
diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx
index 1266576b17b3..271269a35feb 100644
--- a/ucb/source/core/provprox.cxx
+++ b/ucb/source/core/provprox.cxx
@@ -158,13 +158,13 @@ Sequence< Type > SAL_CALL UcbContentProviderProxy::getTypes()
}
else
{
- static cppu::OTypeCollection collection(
+ static cppu::OTypeCollection s_aCollection(
CPPU_TYPE_REF( XTypeProvider ),
CPPU_TYPE_REF( XServiceInfo ),
CPPU_TYPE_REF( XContentProvider ),
CPPU_TYPE_REF( XParameterizedContentProvider ),
CPPU_TYPE_REF( XContentProviderSupplier ) );
- return collection.getTypes();
+ return s_aCollection.getTypes();
}
}
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index def0db069191..4a8e75c65837 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1946,7 +1946,7 @@ namespace cmis
{
if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) )
{
- static cppu::OTypeCollection aFolderCollection
+ static cppu::OTypeCollection s_aFolderCollection
(CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -1958,7 +1958,7 @@ namespace cmis
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ),
CPPU_TYPE_REF( ucb::XContentCreator ) );
- return aFolderCollection.getTypes();
+ return s_aFolderCollection.getTypes();
}
}
catch (const uno::RuntimeException&)
@@ -1973,7 +1973,7 @@ namespace cmis
uno::Reference<uno::XInterface>(), a);
}
- static cppu::OTypeCollection aFileCollection
+ static cppu::OTypeCollection s_aFileCollection
(CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -1985,7 +1985,7 @@ namespace cmis
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ) );
- return aFileCollection.getTypes();
+ return s_aFileCollection.getTypes();
}
uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo(
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index 208271edf104..e1754666879d 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -384,7 +384,7 @@ namespace cmis
uno::Sequence< uno::Type > SAL_CALL RepoContent::getTypes()
{
- static cppu::OTypeCollection aFolderCollection
+ static cppu::OTypeCollection s_aFolderCollection
(CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -395,7 +395,7 @@ namespace cmis
CPPU_TYPE_REF( beans::XPropertyContainer ),
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ) );
- return aFolderCollection.getTypes();
+ return s_aFolderCollection.getTypes();
}
list< uno::Reference< ucb::XContent > > RepoContent::getChildren( )
diff --git a/ucb/source/ucp/file/filid.cxx b/ucb/source/ucp/file/filid.cxx
index 220d19fbd1f2..9b5cb78d2809 100644
--- a/ucb/source/ucp/file/filid.cxx
+++ b/ucb/source/ucp/file/filid.cxx
@@ -86,18 +86,11 @@ FileContentIdentifier::getImplementationId()
uno::Sequence< uno::Type > SAL_CALL
FileContentIdentifier::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<XContentIdentifier>::get() );
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
+
+ return s_aCollection.getTypes();
}
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index 89c779b58285..287d7eb88bc4 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -152,13 +152,7 @@ css::uno::Sequence< sal_Int8 > SAL_CALL FTPContent::getImplementationId()
css::uno::Sequence< css::uno::Type > SAL_CALL FTPContent::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<XTypeProvider>::get(),
cppu::UnoType<XServiceInfo>::get(),
cppu::UnoType<XContent>::get(),
@@ -166,10 +160,8 @@ css::uno::Sequence< css::uno::Type > SAL_CALL FTPContent::getTypes()
cppu::UnoType<XContentCreator>::get(),
cppu::UnoType<XChild>::get()
);
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
+
+ return s_aCollection.getTypes();
}
diff --git a/ucb/source/ucp/ftp/ftpcontentidentifier.cxx b/ucb/source/ucp/ftp/ftpcontentidentifier.cxx
index 683422366703..f60f800759e9 100644
--- a/ucb/source/ucp/ftp/ftpcontentidentifier.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentidentifier.cxx
@@ -79,18 +79,11 @@ FTPContentIdentifier::getImplementationId()
Sequence<Type> SAL_CALL
FTPContentIdentifier::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<XTypeProvider>::get(),
cppu::UnoType<XContentIdentifier>::get());
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
+
+ return s_aCollection.getTypes();
}
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index af214d9ea3a8..4630e22653a5 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -82,21 +82,13 @@ css::uno::Sequence< sal_Int8 > SAL_CALL FTPContentProvider::getImplementationId(
css::uno::Sequence< css::uno::Type > SAL_CALL FTPContentProvider::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<XTypeProvider>::get(),
cppu::UnoType<XServiceInfo>::get(),
cppu::UnoType<XContentProvider>::get()
);
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
+
+ return s_aCollection.getTypes();
}
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 1e7a4d55775b..c1bb36ff71c4 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -23,7 +23,6 @@
#include <sal/macros.h>
#include <osl/time.h>
-#include <osl/doublecheckedlocking.h>
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -1176,7 +1175,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
{
if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) )
{
- static cppu::OTypeCollection aFolderCollection
+ static cppu::OTypeCollection s_aFolderCollection
(CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -1188,11 +1187,11 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ),
CPPU_TYPE_REF( ucb::XContentCreator ) );
- return aFolderCollection.getTypes();
+ return s_aFolderCollection.getTypes();
}
else
{
- static cppu::OTypeCollection aFileCollection
+ static cppu::OTypeCollection s_aFileCollection
(CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -1204,7 +1203,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ) );
- return aFileCollection.getTypes();
+ return s_aFileCollection.getTypes();
}
}
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
index 8ff414b5816e..fe1750221fee 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
@@ -37,7 +37,6 @@
*************************************************************************/
#include <osl/diagnose.h>
-#include "osl/doublecheckedlocking.h"
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
#include <com/sun/star/beans/IllegalTypeException.hpp>
@@ -201,21 +200,9 @@ XTYPEPROVIDER_COMMON_IMPL( HierarchyContent );
// virtual
uno::Sequence< uno::Type > SAL_CALL HierarchyContent::getTypes()
{
- cppu::OTypeCollection * pCollection = nullptr;
-
if ( isFolder() && !isReadOnly() )
{
- 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 ),
@@ -226,29 +213,14 @@ uno::Sequence< uno::Type > SAL_CALL HierarchyContent::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 ),
@@ -259,17 +231,9 @@ uno::Sequence< uno::Type > SAL_CALL HierarchyContent::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/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index c632656f86c0..63f6a21bf9b0 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -29,7 +29,6 @@
#include "hierarchydatasource.hxx"
#include <osl/diagnose.h>
-#include "osl/doublecheckedlocking.h"
#include <comphelper/processfactory.hxx>
#include <comphelper/interfacecontainer2.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -607,49 +606,21 @@ XTYPEPROVIDER_COMMON_IMPL( HierarchyDataAccess );
// virtual
uno::Sequence< uno::Type > SAL_CALL HierarchyDataAccess::getTypes()
{
- cppu::OTypeCollection * pCollection = nullptr;
-
if ( m_bReadOnly )
{
- static cppu::OTypeCollection* pReadOnlyTypes = nullptr;
-
- pCollection = pReadOnlyTypes;
- if ( !pCollection )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
- pCollection = pReadOnlyTypes;
- if ( !pCollection )
- {
- static cppu::OTypeCollection aCollection(
+ static cppu::OTypeCollection s_aReadOnlyTypes(
CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
CPPU_TYPE_REF( container::XHierarchicalNameAccess ),
CPPU_TYPE_REF( container::XNameAccess ),
CPPU_TYPE_REF( util::XChangesNotifier ) );
- pCollection = &aCollection;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- pReadOnlyTypes = pCollection;
- }
- }
- else {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
+
+ return s_aReadOnlyTypes.getTypes();
}
else
{
- static cppu::OTypeCollection* pReadWriteTypes = nullptr;
-
- pCollection = pReadWriteTypes;
- if ( !pCollection )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
- pCollection = pReadWriteTypes;
- if ( !pCollection )
- {
- static cppu::OTypeCollection aCollection(
+ static cppu::OTypeCollection s_aReadWriteTypes(
CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -658,17 +629,9 @@ uno::Sequence< uno::Type > SAL_CALL HierarchyDataAccess::getTypes()
CPPU_TYPE_REF( container::XNameContainer ),
CPPU_TYPE_REF( util::XChangesBatch ),
CPPU_TYPE_REF( util::XChangesNotifier ) );
- pCollection = &aCollection;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- pReadWriteTypes = pCollection;
- }
- }
- else {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
- }
- return (*pCollection).getTypes();
+ return s_aReadWriteTypes.getTypes();
+ }
}
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index 72d0ec5acb99..7550d7eef252 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -24,7 +24,6 @@
*************************************************************************/
#include <osl/diagnose.h>
-#include "osl/doublecheckedlocking.h"
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
#include <com/sun/star/beans/IllegalTypeException.hpp>
@@ -317,21 +316,9 @@ XTYPEPROVIDER_COMMON_IMPL( Content );
// virtual
uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
{
- cppu::OTypeCollection * pCollection = nullptr;
-
if ( isFolder() )
{
- 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 ),
@@ -342,29 +329,14 @@ 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 ),
@@ -375,17 +347,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_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();
}
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 29b026db5165..d8679c095364 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -36,7 +36,6 @@
#include <memory>
#include <comphelper/processfactory.hxx>
#include <osl/diagnose.h>
-#include <osl/doublecheckedlocking.h>
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <officecfg/Inet.hxx>
@@ -369,21 +368,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
{
}
- cppu::OTypeCollection * pCollection = nullptr;
-
if ( bFolder )
{
- 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 ),
@@ -394,29 +381,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 ),
@@ -427,17 +398,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/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 2fcbb2b200fb..b9d93fa9c907 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -19,7 +19,6 @@
#include <memory>
#include <osl/diagnose.h>
-#include <osl/doublecheckedlocking.h>
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <ucbhelper/contentidentifier.hxx>
@@ -358,18 +357,8 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
if ( bFolder )
{
- 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(
- CPPU_TYPE_REF( lang::XTypeProvider ),
+ static cppu::OTypeCollection s_aFolderTypes(
+ CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
CPPU_TYPE_REF( ucb::XContent ),
@@ -379,29 +368,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 ),
@@ -412,17 +385,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();
+ }
}