summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/package
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/package
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/package')
-rw-r--r--ucb/source/ucp/package/pkgcontent.cxx52
1 files changed, 8 insertions, 44 deletions
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();
+ }
}