You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
645 lines
18 KiB
645 lines
18 KiB
14 years ago
|
--- cppu/source/threadpool/jobqueue.cxx 2008-04-11 11:33:02.000000000 +0100
|
||
|
+++ cppu/source/threadpool/jobqueue.cxx 2009-12-02 16:14:26.000000000 +0000
|
||
|
@@ -45,6 +45,7 @@
|
||
|
m_cndWait( osl_createCondition() )
|
||
|
{
|
||
|
osl_resetCondition( m_cndWait );
|
||
|
+ m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
|
||
|
}
|
||
|
|
||
|
JobQueue::~JobQueue()
|
||
|
@@ -71,7 +72,7 @@
|
||
|
{
|
||
|
// synchronize with the dispose calls
|
||
|
MutexGuard guard( m_mutex );
|
||
|
- if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) )
|
||
|
+ if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) )
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
--- cppu/source/threadpool/jobqueue.hxx 2008-04-11 11:33:18.000000000 +0100
|
||
|
+++ cppu/source/threadpool/jobqueue.hxx 2009-12-02 16:15:49.000000000 +0000
|
||
|
@@ -37,6 +37,8 @@
|
||
|
#include <osl/conditn.h>
|
||
|
#include <osl/mutex.hxx>
|
||
|
|
||
|
+#include <boost/shared_ptr.hpp>
|
||
|
+
|
||
|
namespace cppu_threadpool
|
||
|
{
|
||
|
extern "C" typedef void (SAL_CALL RequestFun)(void *);
|
||
|
@@ -51,6 +53,9 @@
|
||
|
|
||
|
typedef ::std::list < sal_Int64 > CallStackList;
|
||
|
|
||
|
+ class DisposedCallerAdmin;
|
||
|
+ typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
|
||
|
+
|
||
|
class JobQueue
|
||
|
{
|
||
|
public:
|
||
|
@@ -76,6 +81,7 @@
|
||
|
sal_Int32 m_nToDo;
|
||
|
sal_Bool m_bSuspended;
|
||
|
oslCondition m_cndWait;
|
||
|
+ DisposedCallerAdminHolder m_DisposedCallerAdmin;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
--- cppu/source/threadpool/thread.cxx 2008-04-11 11:34:00.000000000 +0100
|
||
|
+++ cppu/source/threadpool/thread.cxx 2009-12-03 16:15:02.000000000 +0000
|
||
|
@@ -31,6 +31,8 @@
|
||
|
#include <osl/diagnose.h>
|
||
|
#include <uno/threadpool.h>
|
||
|
|
||
|
+#include <rtl/instance.hxx>
|
||
|
+
|
||
|
#include "thread.hxx"
|
||
|
#include "jobqueue.hxx"
|
||
|
#include "threadpool.hxx"
|
||
|
@@ -98,20 +100,17 @@
|
||
|
} while( pCurrent );
|
||
|
}
|
||
|
|
||
|
- ThreadAdmin* ThreadAdmin::getInstance()
|
||
|
+ struct theThreadAdmin : public rtl::StaticWithInit< ThreadAdminHolder, theThreadAdmin >
|
||
|
{
|
||
|
- static ThreadAdmin *pThreadAdmin = 0;
|
||
|
- if( ! pThreadAdmin )
|
||
|
- {
|
||
|
- MutexGuard guard( Mutex::getGlobalMutex() );
|
||
|
- if( ! pThreadAdmin )
|
||
|
- {
|
||
|
- static ThreadAdmin admin;
|
||
|
- pThreadAdmin = &admin;
|
||
|
- }
|
||
|
+ ThreadAdminHolder operator () () {
|
||
|
+ ThreadAdminHolder aRet(new ThreadAdmin());
|
||
|
+ return aRet;
|
||
|
}
|
||
|
- return pThreadAdmin;
|
||
|
+ };
|
||
|
|
||
|
+ ThreadAdminHolder& ThreadAdmin::getInstance()
|
||
|
+ {
|
||
|
+ return theThreadAdmin::get();
|
||
|
}
|
||
|
|
||
|
// ----------------------------------------------------------------------------------
|
||
|
@@ -119,12 +118,13 @@
|
||
|
const ByteSequence &aThreadId,
|
||
|
sal_Bool bAsynchron )
|
||
|
: m_thread( 0 )
|
||
|
+ , m_aThreadAdmin( ThreadAdmin::getInstance() )
|
||
|
, m_pQueue( pQueue )
|
||
|
, m_aThreadId( aThreadId )
|
||
|
, m_bAsynchron( bAsynchron )
|
||
|
, m_bDeleteSelf( sal_True )
|
||
|
{
|
||
|
- ThreadAdmin::getInstance()->add( this );
|
||
|
+ m_aThreadAdmin->add( this );
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -166,7 +166,7 @@
|
||
|
|
||
|
void ORequestThread::onTerminated()
|
||
|
{
|
||
|
- ThreadAdmin::getInstance()->remove( this );
|
||
|
+ m_aThreadAdmin->remove( this );
|
||
|
if( m_bDeleteSelf )
|
||
|
{
|
||
|
delete this;
|
||
|
@@ -175,6 +175,8 @@
|
||
|
|
||
|
void ORequestThread::run()
|
||
|
{
|
||
|
+ ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance();
|
||
|
+
|
||
|
while ( m_pQueue )
|
||
|
{
|
||
|
if( ! m_bAsynchron )
|
||
|
@@ -197,7 +199,7 @@
|
||
|
|
||
|
if( m_pQueue->isEmpty() )
|
||
|
{
|
||
|
- ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron );
|
||
|
+ theThreadPool->revokeQueue( m_aThreadId , m_bAsynchron );
|
||
|
// Note : revokeQueue might have failed because m_pQueue.isEmpty()
|
||
|
// may be false (race).
|
||
|
}
|
||
|
@@ -211,7 +213,7 @@
|
||
|
uno_releaseIdFromCurrentThread();
|
||
|
}
|
||
|
|
||
|
- cppu_threadpool::ThreadPool::getInstance()->waitInPool( this );
|
||
|
+ theThreadPool->waitInPool( this );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
--- cppu/source/threadpool/thread.hxx 2008-04-11 11:34:18.000000000 +0100
|
||
|
+++ cppu/source/threadpool/thread.hxx 2009-12-02 15:58:34.000000000 +0000
|
||
|
@@ -37,6 +37,8 @@
|
||
|
namespace cppu_threadpool {
|
||
|
|
||
|
class JobQueue;
|
||
|
+ class ThreadAdmin;
|
||
|
+ typedef boost::shared_ptr<ThreadAdmin> ThreadAdminHolder;
|
||
|
|
||
|
//-----------------------------------------
|
||
|
// private thread class for the threadpool
|
||
|
@@ -61,6 +63,7 @@
|
||
|
|
||
|
private:
|
||
|
oslThread m_thread;
|
||
|
+ ThreadAdminHolder m_aThreadAdmin;
|
||
|
JobQueue *m_pQueue;
|
||
|
::rtl::ByteSequence m_aThreadId;
|
||
|
sal_Bool m_bAsynchron;
|
||
|
@@ -71,7 +74,7 @@
|
||
|
{
|
||
|
public:
|
||
|
~ThreadAdmin ();
|
||
|
- static ThreadAdmin *getInstance();
|
||
|
+ static ThreadAdminHolder &getInstance();
|
||
|
void add( ORequestThread * );
|
||
|
void remove( ORequestThread * );
|
||
|
void join();
|
||
|
--- cppu/source/threadpool/threadpool.cxx 2008-04-11 11:34:54.000000000 +0100
|
||
|
+++ cppu/source/threadpool/threadpool.cxx 2009-12-03 16:14:56.000000000 +0000
|
||
|
@@ -33,6 +33,7 @@
|
||
|
#include <osl/diagnose.h>
|
||
|
#include <osl/mutex.hxx>
|
||
|
#include <osl/thread.h>
|
||
|
+#include <rtl/instance.hxx>
|
||
|
|
||
|
#include <uno/threadpool.h>
|
||
|
|
||
|
@@ -44,19 +45,17 @@
|
||
|
|
||
|
namespace cppu_threadpool
|
||
|
{
|
||
|
- DisposedCallerAdmin *DisposedCallerAdmin::getInstance()
|
||
|
+ struct theDisposedCallerAdmin :
|
||
|
+ public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin >
|
||
|
{
|
||
|
- static DisposedCallerAdmin *pDisposedCallerAdmin = 0;
|
||
|
- if( ! pDisposedCallerAdmin )
|
||
|
- {
|
||
|
- MutexGuard guard( Mutex::getGlobalMutex() );
|
||
|
- if( ! pDisposedCallerAdmin )
|
||
|
- {
|
||
|
- static DisposedCallerAdmin admin;
|
||
|
- pDisposedCallerAdmin = &admin;
|
||
|
- }
|
||
|
+ DisposedCallerAdminHolder operator () () {
|
||
|
+ return DisposedCallerAdminHolder(new DisposedCallerAdmin());
|
||
|
}
|
||
|
- return pDisposedCallerAdmin;
|
||
|
+ };
|
||
|
+
|
||
|
+ DisposedCallerAdminHolder DisposedCallerAdmin::getInstance()
|
||
|
+ {
|
||
|
+ return theDisposedCallerAdmin::get();
|
||
|
}
|
||
|
|
||
|
DisposedCallerAdmin::~DisposedCallerAdmin()
|
||
|
@@ -107,6 +106,21 @@
|
||
|
|
||
|
|
||
|
//-------------------------------------------------------------------------------
|
||
|
+
|
||
|
+ struct theThreadPool :
|
||
|
+ public rtl::StaticWithInit< ThreadPoolHolder, theThreadPool >
|
||
|
+ {
|
||
|
+ ThreadPoolHolder operator () () {
|
||
|
+ ThreadPoolHolder aRet(new ThreadPool());
|
||
|
+ return aRet;
|
||
|
+ }
|
||
|
+ };
|
||
|
+
|
||
|
+ ThreadPool::ThreadPool()
|
||
|
+ {
|
||
|
+ m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
|
||
|
+ }
|
||
|
+
|
||
|
ThreadPool::~ThreadPool()
|
||
|
{
|
||
|
#if OSL_DEBUG_LEVEL > 1
|
||
|
@@ -116,19 +130,9 @@
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
- ThreadPool *ThreadPool::getInstance()
|
||
|
+ ThreadPoolHolder ThreadPool::getInstance()
|
||
|
{
|
||
|
- static ThreadPool *pThreadPool = 0;
|
||
|
- if( ! pThreadPool )
|
||
|
- {
|
||
|
- MutexGuard guard( Mutex::getGlobalMutex() );
|
||
|
- if( ! pThreadPool )
|
||
|
- {
|
||
|
- static ThreadPool pool;
|
||
|
- pThreadPool = &pool;
|
||
|
- }
|
||
|
- }
|
||
|
- return pThreadPool;
|
||
|
+ return theThreadPool::get();
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -136,7 +140,7 @@
|
||
|
{
|
||
|
if( nDisposeId )
|
||
|
{
|
||
|
- DisposedCallerAdmin::getInstance()->dispose( nDisposeId );
|
||
|
+ m_DisposedCallerAdmin->dispose( nDisposeId );
|
||
|
|
||
|
MutexGuard guard( m_mutex );
|
||
|
for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ;
|
||
|
@@ -171,7 +175,7 @@
|
||
|
|
||
|
void ThreadPool::stopDisposing( sal_Int64 nDisposeId )
|
||
|
{
|
||
|
- DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId );
|
||
|
+ m_DisposedCallerAdmin->stopDisposing( nDisposeId );
|
||
|
}
|
||
|
|
||
|
/******************
|
||
|
@@ -400,7 +404,7 @@
|
||
|
|
||
|
|
||
|
|
||
|
-typedef ::std::hash_set< uno_ThreadPool, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
|
||
|
+typedef ::std::hash_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
|
||
|
|
||
|
static ThreadpoolHashSet *g_pThreadpoolHashSet;
|
||
|
|
||
|
@@ -420,7 +424,7 @@
|
||
|
|
||
|
// Just ensure that the handle is unique in the process (via heap)
|
||
|
uno_ThreadPool h = new struct _uno_ThreadPool;
|
||
|
- g_pThreadpoolHashSet->insert( h );
|
||
|
+ g_pThreadpoolHashSet->insert( ThreadpoolHashSet::value_type(h, ThreadPool::getInstance()) );
|
||
|
return h;
|
||
|
}
|
||
|
|
||
|
--- cppu/source/threadpool/threadpool.hxx 2008-04-11 11:35:13.000000000 +0100
|
||
|
+++ cppu/source/threadpool/threadpool.hxx 2009-12-02 16:12:13.000000000 +0000
|
||
|
@@ -33,6 +33,8 @@
|
||
|
|
||
|
#include <rtl/byteseq.hxx>
|
||
|
|
||
|
+#include <boost/shared_ptr.hpp>
|
||
|
+
|
||
|
#include "jobqueue.hxx"
|
||
|
|
||
|
|
||
|
@@ -78,13 +80,16 @@
|
||
|
};
|
||
|
|
||
|
typedef ::std::list < struct ::cppu_threadpool::WaitingThread * > WaitingThreadList;
|
||
|
+
|
||
|
+ class DisposedCallerAdmin;
|
||
|
+ typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
|
||
|
|
||
|
class DisposedCallerAdmin
|
||
|
{
|
||
|
public:
|
||
|
~DisposedCallerAdmin();
|
||
|
|
||
|
- static DisposedCallerAdmin *getInstance();
|
||
|
+ static DisposedCallerAdminHolder getInstance();
|
||
|
|
||
|
void dispose( sal_Int64 nDisposeId );
|
||
|
void stopDisposing( sal_Int64 nDisposeId );
|
||
|
@@ -95,11 +100,15 @@
|
||
|
DisposedCallerList m_lst;
|
||
|
};
|
||
|
|
||
|
+ class ThreadPool;
|
||
|
+ typedef boost::shared_ptr<ThreadPool> ThreadPoolHolder;
|
||
|
+
|
||
|
class ThreadPool
|
||
|
{
|
||
|
public:
|
||
|
+ ThreadPool();
|
||
|
~ThreadPool();
|
||
|
- static ThreadPool *getInstance();
|
||
|
+ static ThreadPoolHolder getInstance();
|
||
|
|
||
|
void dispose( sal_Int64 nDisposeId );
|
||
|
void stopDisposing( sal_Int64 nDisposeId );
|
||
|
@@ -127,6 +136,8 @@
|
||
|
|
||
|
::osl::Mutex m_mutexWaitingThreadList;
|
||
|
WaitingThreadList m_lstThreads;
|
||
|
+
|
||
|
+ DisposedCallerAdminHolder m_DisposedCallerAdmin;
|
||
|
};
|
||
|
|
||
|
} // end namespace cppu_threadpool
|
||
|
--- cppu/source/uno/lbenv.cxx 2009-02-12 10:18:09.000000000 +0000
|
||
|
+++ cppu/source/uno/lbenv.cxx 2009-12-03 16:14:26.000000000 +0000
|
||
|
@@ -142,6 +142,7 @@
|
||
|
::osl::Mutex mutex;
|
||
|
OUString2EnvironmentMap aName2EnvMap;
|
||
|
|
||
|
+ EnvironmentsData() : isDisposing(false) {}
|
||
|
~EnvironmentsData();
|
||
|
|
||
|
inline void getEnvironment(
|
||
|
@@ -150,6 +151,8 @@
|
||
|
inline void getRegisteredEnvironments(
|
||
|
uno_Environment *** pppEnvs, sal_Int32 * pnLen,
|
||
|
uno_memAlloc memAlloc, const OUString & rEnvDcp );
|
||
|
+
|
||
|
+ bool isDisposing;
|
||
|
};
|
||
|
|
||
|
namespace
|
||
|
@@ -598,9 +601,14 @@
|
||
|
*ppHardEnv = 0;
|
||
|
}
|
||
|
|
||
|
+ EnvironmentsData & rData = theEnvironmentsData::get();
|
||
|
+
|
||
|
+ if (rData.isDisposing)
|
||
|
+ return;
|
||
|
+
|
||
|
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
|
||
|
{
|
||
|
- ::osl::MutexGuard guard( theEnvironmentsData::get().mutex );
|
||
|
+ ::osl::MutexGuard guard( rData.mutex );
|
||
|
if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead
|
||
|
{
|
||
|
that->nRef = 0;
|
||
|
@@ -917,6 +925,7 @@
|
||
|
EnvironmentsData::~EnvironmentsData()
|
||
|
{
|
||
|
::osl::MutexGuard guard( mutex );
|
||
|
+ isDisposing = true;
|
||
|
|
||
|
for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
|
||
|
iPos != aName2EnvMap.end(); ++iPos )
|
||
|
--- cppu/util/target.pmk 2008-04-11 12:07:15.000000000 +0100
|
||
|
+++ cppu/util/target.pmk 2009-12-02 15:50:08.000000000 +0000
|
||
|
@@ -55,12 +55,3 @@
|
||
|
.ENDIF
|
||
|
|
||
|
.ENDIF
|
||
|
-
|
||
|
-# other stuff
|
||
|
-
|
||
|
-.IF "$(cppu_no_leak)" == ""
|
||
|
-.IF "$(bndchk)" == ""
|
||
|
-CFLAGS += -DCPPU_LEAK_STATIC_DATA
|
||
|
-.ENDIF
|
||
|
-.ENDIF
|
||
|
-
|
||
|
--- package/inc/ZipPackageFolder.hxx 2010-06-22 11:49:17.000000000 +0100
|
||
|
+++ package/inc/ZipPackageFolder.hxx 2010-06-22 12:50:26.000000000 +0100
|
||
|
@@ -53,8 +53,6 @@
|
||
|
::com::sun::star::container::XEnumerationAccess
|
||
|
>
|
||
|
{
|
||
|
- static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
|
||
|
-
|
||
|
protected:
|
||
|
ContentHash maContents;
|
||
|
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
|
||
|
@@ -82,10 +80,7 @@
|
||
|
throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||
|
|
||
|
static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource);
|
||
|
- static ::com::sun::star::uno::Sequence < sal_Int8 > static_getImplementationId()
|
||
|
- {
|
||
|
- return aImplementationId;
|
||
|
- }
|
||
|
+ static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
|
||
|
|
||
|
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
|
||
|
void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
|
||
|
--- package/source/xstor/owriteablestream.cxx 2010-06-22 11:49:15.000000000 +0100
|
||
|
+++ package/source/xstor/owriteablestream.cxx 2010-06-22 12:13:20.000000000 +0100
|
||
|
@@ -53,6 +53,7 @@
|
||
|
|
||
|
#include <rtl/digest.h>
|
||
|
#include <rtl/logfile.hxx>
|
||
|
+#include <rtl/instance.hxx>
|
||
|
|
||
|
// since the copying uses 32000 blocks usually, it makes sense to have a smaller size
|
||
|
#define MAX_STORCACHE_SIZE 30000
|
||
|
@@ -2169,25 +2170,14 @@
|
||
|
return m_pData->m_pTypeCollection->getTypes() ;
|
||
|
}
|
||
|
|
||
|
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
|
||
|
+
|
||
|
//-----------------------------------------------
|
||
|
uno::Sequence< sal_Int8 > SAL_CALL OWriteStream::getImplementationId()
|
||
|
throw( uno::RuntimeException )
|
||
|
{
|
||
|
- static ::cppu::OImplementationId* pID = NULL ;
|
||
|
-
|
||
|
- if ( pID == NULL )
|
||
|
- {
|
||
|
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
|
||
|
-
|
||
|
- if ( pID == NULL )
|
||
|
- {
|
||
|
- static ::cppu::OImplementationId aID( sal_False ) ;
|
||
|
- pID = &aID ;
|
||
|
- }
|
||
|
- }
|
||
|
-
|
||
|
- return pID->getImplementationId() ;
|
||
|
-
|
||
|
+ ::cppu::OImplementationId &rId = lcl_ImplId::get();
|
||
|
+ return rId.getImplementationId();
|
||
|
}
|
||
|
|
||
|
//-----------------------------------------------
|
||
|
--- package/source/xstor/xstorage.cxx 2010-06-22 11:49:15.000000000 +0100
|
||
|
+++ package/source/xstor/xstorage.cxx 2010-06-22 12:11:45.000000000 +0100
|
||
|
@@ -48,6 +48,7 @@
|
||
|
#include <cppuhelper/typeprovider.hxx>
|
||
|
#include <cppuhelper/exc_hlp.hxx>
|
||
|
#include <rtl/logfile.hxx>
|
||
|
+#include <rtl/instance.hxx>
|
||
|
|
||
|
#include <comphelper/processfactory.hxx>
|
||
|
#include <comphelper/componentcontext.hxx>
|
||
|
@@ -2367,25 +2368,14 @@
|
||
|
return m_pData->m_pTypeCollection->getTypes() ;
|
||
|
}
|
||
|
|
||
|
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
|
||
|
+
|
||
|
//-----------------------------------------------
|
||
|
uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId()
|
||
|
throw( uno::RuntimeException )
|
||
|
{
|
||
|
- static ::cppu::OImplementationId* pID = NULL ;
|
||
|
-
|
||
|
- if ( pID == NULL )
|
||
|
- {
|
||
|
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
|
||
|
-
|
||
|
- if ( pID == NULL )
|
||
|
- {
|
||
|
- static ::cppu::OImplementationId aID( sal_False ) ;
|
||
|
- pID = &aID ;
|
||
|
- }
|
||
|
- }
|
||
|
-
|
||
|
- return pID->getImplementationId() ;
|
||
|
-
|
||
|
+ ::cppu::OImplementationId &rID = lcl_ImplId::get();
|
||
|
+ return rID.getImplementationId();
|
||
|
}
|
||
|
|
||
|
//____________________________________________________________________________________________________
|
||
|
--- package/source/zippackage/ZipPackage.cxx 2010-06-22 11:49:16.000000000 +0100
|
||
|
+++ package/source/zippackage/ZipPackage.cxx 2010-06-22 12:12:00.000000000 +0100
|
||
|
@@ -68,6 +68,7 @@
|
||
|
#include <rtl/uri.hxx>
|
||
|
#include <rtl/random.h>
|
||
|
#include <rtl/logfile.hxx>
|
||
|
+#include <rtl/instance.hxx>
|
||
|
#include <osl/time.h>
|
||
|
#include <osl/file.hxx>
|
||
|
#include "com/sun/star/io/XAsyncOutputMonitor.hpp"
|
||
|
@@ -1585,21 +1586,14 @@
|
||
|
static_getSupportedServiceNames());
|
||
|
}
|
||
|
|
||
|
+namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
|
||
|
+
|
||
|
// XUnoTunnel
|
||
|
Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void )
|
||
|
throw (RuntimeException)
|
||
|
{
|
||
|
- static ::cppu::OImplementationId * pId = 0;
|
||
|
- if (! pId)
|
||
|
- {
|
||
|
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
||
|
- if (! pId)
|
||
|
- {
|
||
|
- static ::cppu::OImplementationId aId;
|
||
|
- pId = &aId;
|
||
|
- }
|
||
|
- }
|
||
|
- return pId->getImplementationId();
|
||
|
+ ::cppu::OImplementationId &rId = lcl_ImplId::get();
|
||
|
+ return rId.getImplementationId();
|
||
|
}
|
||
|
|
||
|
sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier )
|
||
|
--- package/source/zippackage/ZipPackageFolder.cxx 2010-06-22 11:49:16.000000000 +0100
|
||
|
+++ package/source/zippackage/ZipPackageFolder.cxx 2010-06-22 12:50:00.000000000 +0100
|
||
|
@@ -43,6 +43,7 @@
|
||
|
#include <com/sun/star/io/XSeekable.hpp>
|
||
|
#include <EncryptedDataHeader.hxx>
|
||
|
#include <rtl/random.h>
|
||
|
+#include <rtl/instance.hxx>
|
||
|
#include <memory>
|
||
|
|
||
|
using namespace com::sun::star::packages::zip::ZipConstants;
|
||
|
@@ -59,7 +60,7 @@
|
||
|
using namespace ::com::sun::star;
|
||
|
using vos::ORef;
|
||
|
|
||
|
-Sequence < sal_Int8 > ZipPackageFolder::aImplementationId = Sequence < sal_Int8 > ();
|
||
|
+namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
|
||
|
|
||
|
ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory,
|
||
|
sal_Int32 nFormat,
|
||
|
@@ -80,10 +81,9 @@
|
||
|
aEntry.nCompressedSize = 0;
|
||
|
aEntry.nSize = 0;
|
||
|
aEntry.nOffset = -1;
|
||
|
- if ( !aImplementationId.getLength() )
|
||
|
- {
|
||
|
- aImplementationId = getImplementationId();
|
||
|
- }
|
||
|
+ Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
|
||
|
+ if ( !rCachedImplId.getLength() )
|
||
|
+ rCachedImplId = getImplementationId();
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -187,6 +187,11 @@
|
||
|
rDest.nExtraLen = rSource.nExtraLen;
|
||
|
}
|
||
|
|
||
|
+const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_getImplementationId()
|
||
|
+{
|
||
|
+ return lcl_CachedImplId::get();
|
||
|
+}
|
||
|
+
|
||
|
// XNameContainer
|
||
|
void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement )
|
||
|
throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
|
||
|
--- package/source/zippackage/ZipPackageStream.cxx 2010-06-22 11:49:16.000000000 +0100
|
||
|
+++ package/source/zippackage/ZipPackageStream.cxx 2010-06-22 12:53:32.000000000 +0100
|
||
|
@@ -45,6 +45,8 @@
|
||
|
#include <comphelper/seekableinput.hxx>
|
||
|
#include <comphelper/storagehelper.hxx>
|
||
|
|
||
|
+#include <rtl/instance.hxx>
|
||
|
+
|
||
|
#include <PackageConstants.hxx>
|
||
|
|
||
|
using namespace com::sun::star::packages::zip::ZipConstants;
|
||
|
@@ -55,8 +57,12 @@
|
||
|
using namespace cppu;
|
||
|
using namespace rtl;
|
||
|
|
||
|
-Sequence < sal_Int8 > ZipPackageStream::aImplementationId = Sequence < sal_Int8 > ();
|
||
|
+namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
|
||
|
|
||
|
+const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_getImplementationId()
|
||
|
+{
|
||
|
+ return lcl_CachedImplId::get();
|
||
|
+}
|
||
|
|
||
|
ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
|
||
|
const Reference< XMultiServiceFactory >& xFactory,
|
||
|
@@ -91,10 +97,9 @@
|
||
|
aEntry.nPathLen = -1;
|
||
|
aEntry.nExtraLen = -1;
|
||
|
|
||
|
- if ( !aImplementationId.getLength() )
|
||
|
- {
|
||
|
- aImplementationId = getImplementationId();
|
||
|
- }
|
||
|
+ Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
|
||
|
+ if ( !rCachedImplId.getLength() )
|
||
|
+ rCachedImplId = getImplementationId();
|
||
|
}
|
||
|
|
||
|
ZipPackageStream::~ZipPackageStream( void )
|
||
|
--- package/source/zippackage/ZipPackageStream.hxx 2010-06-22 11:49:16.000000000 +0100
|
||
|
+++ package/source/zippackage/ZipPackageStream.hxx 2010-06-22 12:51:18.000000000 +0100
|
||
|
@@ -55,7 +55,6 @@
|
||
|
::com::sun::star::packages::XDataSinkEncrSupport
|
||
|
>
|
||
|
{
|
||
|
- static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
|
||
|
protected:
|
||
|
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
|
||
|
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
|
||
|
@@ -146,10 +145,7 @@
|
||
|
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData()
|
||
|
throw(::com::sun::star::uno::RuntimeException);
|
||
|
|
||
|
- static ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId()
|
||
|
- {
|
||
|
- return aImplementationId;
|
||
|
- }
|
||
|
+ static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId();
|
||
|
|
||
|
// XActiveDataSink
|
||
|
virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream )
|