diff options
author | sb <sb@openoffice.org> | 2010-10-28 16:37:27 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-10-28 16:37:27 +0200 |
commit | 9bb0061938a0c76a1b221a214dff8afe0bcdcb4e (patch) | |
tree | 893f27e01b67f86ed6bbabcb7e71a6842515841f /configmgr/source | |
parent | sb132: #i115142# component factories should implement XServiceInfo (diff) | |
download | core-9bb0061938a0c76a1b221a214dff8afe0bcdcb4e.tar.gz core-9bb0061938a0c76a1b221a214dff8afe0bcdcb4e.zip |
sb132: #i114877# combined configmgr::Components::{init,get}Singleton
Diffstat (limited to 'configmgr/source')
-rw-r--r-- | configmgr/source/components.cxx | 6 | ||||
-rw-r--r-- | configmgr/source/components.hxx | 4 | ||||
-rw-r--r-- | configmgr/source/configurationprovider.cxx | 6 | ||||
-rw-r--r-- | configmgr/source/update.cxx | 30 |
4 files changed, 23 insertions, 23 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 32478e96813d..2d148959edfc 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -214,7 +214,7 @@ void Components::WriteThread::run() { reference_->clear(); } -void Components::initSingleton( +Components & Components::getSingleton( css::uno::Reference< css::uno::XComponentContext > const & context) { OSL_ASSERT(context.is()); @@ -223,10 +223,6 @@ void Components::initSingleton( static Components theSingleton(context); singleton = &theSingleton; } -} - -Components & Components::getSingleton() { - OSL_ASSERT(singletonCreated); if (singleton == 0) { throw css::uno::RuntimeException( rtl::OUString( diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index 1c735efca6ba..34b693c7e585 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -65,12 +65,10 @@ class RootAccess; class Components: private boost::noncopyable { public: - static void initSingleton( + static Components & getSingleton( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context); - static Components & getSingleton(); - static bool allLocales(rtl::OUString const & locale); rtl::Reference< Node > resolvePathRepresentation( diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index d636737a299e..999253118f11 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -275,8 +275,7 @@ Service::createInstanceWithArguments( static_cast< cppu::OWeakObject * >(this)); } osl::MutexGuard guard(lock); - Components::initSingleton(context_); - Components & components = Components::getSingleton(); + Components & components = Components::getSingleton(context_); rtl::Reference< RootAccess > root( new RootAccess(components, nodepath, locale, update)); if (root->isValue()) { @@ -387,8 +386,7 @@ void Service::flushModifications() const { Components * components; { osl::MutexGuard guard(lock); - Components::initSingleton(context_); - components = &Components::getSingleton(); + components = &Components::getSingleton(context_); } components->flushModifications(); } diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 73074aa7c338..258765158aa3 100644 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -71,7 +71,11 @@ class Service: private boost::noncopyable { public: - Service() {} + Service(css::uno::Reference< css::uno::XComponentContext > const context): + context_(context) + { + OSL_ASSERT(context.is()); + } private: virtual ~Service() {} @@ -92,6 +96,8 @@ private: css::uno::Sequence< rtl::OUString > const & includedPaths, css::uno::Sequence< rtl::OUString > const & excludedPaths) throw (css::uno::RuntimeException); + + css::uno::Reference< css::uno::XComponentContext > context_; }; void Service::insertExtensionXcsFile( @@ -99,7 +105,7 @@ void Service::insertExtensionXcsFile( throw (css::uno::RuntimeException) { osl::MutexGuard g(lock); - Components::getSingleton().insertExtensionXcsFile(shared, fileUri); + Components::getSingleton(context_).insertExtensionXcsFile(shared, fileUri); } void Service::insertExtensionXcuFile( @@ -109,10 +115,10 @@ void Service::insertExtensionXcuFile( Broadcaster bc; { osl::MutexGuard g(lock); + Components & components = Components::getSingleton(context_); Modifications mods; - Components::getSingleton().insertExtensionXcuFile( - shared, fileUri, &mods); - Components::getSingleton().initGlobalBroadcaster( + components.insertExtensionXcuFile(shared, fileUri, &mods); + components.initGlobalBroadcaster( mods, rtl::Reference< RootAccess >(), &bc); } bc.send(); @@ -124,9 +130,10 @@ void Service::removeExtensionXcuFile(rtl::OUString const & fileUri) Broadcaster bc; { osl::MutexGuard g(lock); + Components & components = Components::getSingleton(context_); Modifications mods; - Components::getSingleton().removeExtensionXcuFile(fileUri, &mods); - Components::getSingleton().initGlobalBroadcaster( + components.removeExtensionXcuFile(fileUri, &mods); + components.initGlobalBroadcaster( mods, rtl::Reference< RootAccess >(), &bc); } bc.send(); @@ -141,10 +148,11 @@ void Service::insertModificationXcuFile( Broadcaster bc; { osl::MutexGuard g(lock); + Components & components = Components::getSingleton(context_); Modifications mods; - Components::getSingleton().insertModificationXcuFile( + components.insertModificationXcuFile( fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods); - Components::getSingleton().initGlobalBroadcaster( + components.initGlobalBroadcaster( mods, rtl::Reference< RootAccess >(), &bc); } bc.send(); @@ -153,9 +161,9 @@ void Service::insertModificationXcuFile( } css::uno::Reference< css::uno::XInterface > create( - css::uno::Reference< css::uno::XComponentContext > const &) + css::uno::Reference< css::uno::XComponentContext > const & context) { - return static_cast< cppu::OWeakObject * >(new Service); + return static_cast< cppu::OWeakObject * >(new Service(context)); } rtl::OUString getImplementationName() { |