From d248451ca3e7599145103be6c79c2b78699f12c9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 Jun 2011 10:02:08 +0100 Subject: use tunnel pattern here --- svtools/source/graphic/descriptor.cxx | 18 ++++++------------ svtools/source/graphic/graphic.cxx | 18 +++++++----------- svtools/source/graphic/provider.cxx | 18 ++++++------------ svtools/source/graphic/renderer.cxx | 18 ++++++------------ svtools/source/graphic/transformer.cxx | 1 - 5 files changed, 25 insertions(+), 48 deletions(-) (limited to 'svtools/source/graphic') diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 623c698bcae8..d76b50b54a01 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -31,11 +31,11 @@ #include "descriptor.hxx" -#include #include #include #include #include +#include #include #include @@ -305,21 +305,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes() return aTypes; } -// ------------------------------------------------------------------------------ +namespace +{ + class theGraphicDescriptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicDescriptorUnoTunnelId > {}; +} uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId() throw( uno::RuntimeException ) { - SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicDescriptorUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx index 19c8d904b3d9..cf212d9d8fce 100644 --- a/svtools/source/graphic/graphic.cxx +++ b/svtools/source/graphic/graphic.cxx @@ -29,13 +29,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include #include #include #include #include #include #include "graphic.hxx" +#include using namespace com::sun::star; @@ -114,19 +114,15 @@ void SAL_CALL Graphic::release() throw() // ------------------------------------------------------------------------------ +namespace +{ + class theGraphicUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicUnoTunnelId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static() throw(uno::RuntimeException) { - SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index b08c1eab2035..a8785a5381b1 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -29,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include #include #include #include @@ -46,6 +45,7 @@ #include #include #include +#include #include "descriptor.hxx" #include "graphic.hxx" @@ -143,21 +143,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() return aTypes; } -// ------------------------------------------------------------------------------ +namespace +{ + class theGraphicProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicProviderUnoTunnelId > {}; +} uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() throw(uno::RuntimeException) { - SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicProviderUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index d955fca30cac..ef6385c1298c 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -32,13 +32,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include "graphic.hxx" #include "renderer.hxx" @@ -192,21 +192,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes() return aTypes; } -// ------------------------------------------------------------------------------ +namespace +{ + class theGraphicRendererVCLUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicRendererVCLUnoTunnelId > {}; +} uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId() throw( uno::RuntimeException ) { - SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicRendererVCLUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index 3a0d3c8e2fd4..03c470d2ac69 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -29,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include #include #include #include -- cgit