summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/inc/comphelper/componentmodule.hxx17
-rw-r--r--comphelper/inc/comphelper/servicehelper.hxx32
-rw-r--r--comphelper/inc/comphelper/uno3.hxx17
3 files changed, 34 insertions, 32 deletions
diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx
index cd65ea50577d..308a270a7393 100644
--- a/comphelper/inc/comphelper/componentmodule.hxx
+++ b/comphelper/inc/comphelper/componentmodule.hxx
@@ -305,7 +305,7 @@ namespace comphelper
/* -------------------------------------------------------------------- */ \
class ModuleClass : public ::comphelper::OModule \
{ \
- friend struct CreateModuleClass; \
+ friend struct ModuleClass##Creator; \
typedef ::comphelper::OModule BaseClass; \
\
public: \
@@ -368,14 +368,14 @@ namespace comphelper
//= implementing a OModule for a component library
#define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \
- struct CreateModuleClass \
+ struct ModuleClass##Creator \
{ \
- ModuleClass* operator()() \
- { \
- static ModuleClass* pModule = new ModuleClass; \
- return pModule; \
- } \
+ ModuleClass m_aModuleClass; \
}; \
+ namespace \
+ { \
+ class the##ModuleClass##Instance : public rtl::Static<ModuleClass##Creator, the##ModuleClass##Instance> {}; \
+ } \
\
ModuleClass::ModuleClass() \
:BaseClass() \
@@ -384,8 +384,7 @@ namespace comphelper
\
ModuleClass& ModuleClass::getInstance() \
{ \
- return *rtl_Instance< ModuleClass, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >:: \
- create( CreateModuleClass(), ::osl::GetGlobalMutex() ); \
+ return the##ModuleClass##Instance::get().m_aModuleClass; \
} \
//==========================================================================
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index e691ea2bd76c..0cab5fa8eab4 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -29,6 +29,21 @@
#ifndef _COMPHELPER_SERVICEHELPER_HXX_
#define _COMPHELPER_SERVICEHELPER_HXX_
+#include <rtl/uuid.h>
+#include <rtl/instance.hxx>
+
+class UnoTunnelIdInit
+{
+private:
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq;
+public:
+ UnoTunnelIdInit() : m_aSeq(16)
+ {
+ rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True );
+ }
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
+};
+
/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
that gives access to your implementation for a given interface reference,
if possible.
@@ -49,20 +64,13 @@
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
+namespace \
+{ \
+ class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \
+} \
const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
{ \
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; \
- if( !pSeq ) \
- { \
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if( !pSeq ) \
- { \
- static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
- pSeq = &aSeq; \
- } \
- } \
- return *pSeq; \
+ return the##classname##UnoTunnelId::get()::getSeq(); \
} \
\
classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \
diff --git a/comphelper/inc/comphelper/uno3.hxx b/comphelper/inc/comphelper/uno3.hxx
index 617c200d3fd5..dff10cc994d3 100644
--- a/comphelper/inc/comphelper/uno3.hxx
+++ b/comphelper/inc/comphelper/uno3.hxx
@@ -30,6 +30,7 @@
#define _COMPHELPER_UNO3_HXX_
#include <osl/interlck.h>
+#include <rtl/instance.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/uno/XAggregation.hpp>
#include <comphelper/sequence.hxx>
@@ -197,19 +198,13 @@ namespace comphelper
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
#define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \
+ namespace \
+ { \
+ class the##classname##ImplementationId : public rtl::Static< ::cppu::OImplementationId, the##classname##ImplementationId> {}; \
+ } \
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) \
{ \
- static ::cppu::OImplementationId* pId = NULL; \
- if (!pId) \
- { \
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if (!pId) \
- { \
- static ::cppu::OImplementationId aId; \
- pId = &aId; \
- } \
- } \
- return pId->getImplementationId(); \
+ return the##classname##ImplementationId::get().getImplementationId(); \
}
#define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \