diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-08-31 16:20:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-09-02 12:14:50 +0100 |
commit | 2f1eed483930a96a40a7013a9338a7e0869fc960 (patch) | |
tree | f8535f77c2abb9c25e4e3f85266a1f59d5114916 /scripting | |
parent | 316a5574ed28317219b557a0ebbcae73bf168d76 (diff) |
createNonDocMSPs->ensureNonDocMSPs
put the double-lockery into ensureNonDocMSPs and
the contents into a new createNonDocMSPs
Change-Id: Id09c933396e1a6ae1c45be79131a75729b16932b
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/provider/ActiveMSPList.cxx | 47 | ||||
-rw-r--r-- | scripting/source/provider/ActiveMSPList.hxx | 1 |
2 files changed, 26 insertions, 22 deletions
diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx index 780511448ac7..5bfbb39a474a 100644 --- a/scripting/source/provider/ActiveMSPList.cxx +++ b/scripting/source/provider/ActiveMSPList.cxx @@ -105,7 +105,7 @@ ActiveMSPList::getMSPFromAnyContext( const Any& aContext ) return msp; } - createNonDocMSPs(); + ensureNonDocMSPs(); return m_hMsps[ shareDirString ]; } @@ -264,10 +264,32 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception ) } } - void ActiveMSPList::createNonDocMSPs() { + // do creation of user and share MSPs here + OUString serviceName("com.sun.star.script.provider.MasterScriptProvider"); + Sequence< Any > args(1); + + args[ 0 ] <<= userDirString; + Reference< provider::XScriptProvider > userMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); + // should check if provider reference is valid + m_hMsps[ userDirString ] = userMsp; + + args[ 0 ] <<= shareDirString; + Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); + // should check if provider reference is valid + m_hMsps[ shareDirString ] = shareMsp; + + args[ 0 ] <<= bundledDirString; + Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); + // should check if provider reference is valid + m_hMsps[ bundledDirString ] = bundledMsp; +} + +void +ActiveMSPList::ensureNonDocMSPs() +{ static bool created = false; if ( created ) { @@ -280,28 +302,9 @@ ActiveMSPList::createNonDocMSPs() { return; } - // do creation of user and share MSPs here - OUString serviceName("com.sun.star.script.provider.MasterScriptProvider"); - Sequence< Any > args(1); - - args[ 0 ] <<= userDirString; - Reference< provider::XScriptProvider > userMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); - // should check if provider reference is valid - m_hMsps[ userDirString ] = userMsp; - - args[ 0 ] <<= shareDirString; - Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); - // should check if provider reference is valid - m_hMsps[ shareDirString ] = shareMsp; - - args[ 0 ] <<= bundledDirString; - Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); - // should check if provider reference is valid - m_hMsps[ bundledDirString ] = bundledMsp; - + createNonDocMSPs(); created = true; } - } diff --git a/scripting/source/provider/ActiveMSPList.hxx b/scripting/source/provider/ActiveMSPList.hxx index cd3dc110f334..a50b6e5d7b34 100644 --- a/scripting/source/provider/ActiveMSPList.hxx +++ b/scripting/source/provider/ActiveMSPList.hxx @@ -88,6 +88,7 @@ private: return createNewMSP( css::uno::makeAny( context ) ); } + void ensureNonDocMSPs(); void createNonDocMSPs(); Msp_hash m_hMsps; ScriptComponent_map m_mScriptComponents; |