summaryrefslogtreecommitdiff
path: root/cppuhelper/source/servicemanager.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-16 15:29:41 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-16 18:40:05 +0100
commit997d21183322a0a94b96868073808841d2773902 (patch)
tree250e92ab34ac79b4c3a8624a5e3ca8afb8df4d54 /cppuhelper/source/servicemanager.hxx
parent9c46e4069db51ab0fc8b3e197d27b5f947a3fdeb (diff)
Support for singleton constructor functions
The service manager now keeps track of instances of singleton implementations (i.e., implementations whose XML description lists at least one <singleton ...>). These instances will be disposed either when the service manager is disposed, or, for instances that have been instantiated into the component context's /singleton/* map, when the component context is disposed. This change allows to use constructor functions for such singleton implementations, too. Change-Id: I220c9ddc9824e4d7f7556daefb599e2ec36b0e6c
Diffstat (limited to 'cppuhelper/source/servicemanager.hxx')
-rw-r--r--cppuhelper/source/servicemanager.hxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx
index 74f2f4acb51f..cefeb316bd9c 100644
--- a/cppuhelper/source/servicemanager.hxx
+++ b/cppuhelper/source/servicemanager.hxx
@@ -105,7 +105,7 @@ public:
new ImplementationInfo(
name, loader, uri, environment, constructorName, prefix,
alienContext, rdbFile)),
- constructor(0), loaded(false)
+ constructor(0), status(STATUS_NEW)
{}
Implementation(
@@ -118,15 +118,33 @@ public:
theComponent):
info(new ImplementationInfo(name)), constructor(0),
factory1(theFactory1), factory2(theFactory2),
- component(theComponent), loaded(true)
+ component(theComponent), status(STATUS_LOADED)
{}
+ css::uno::Reference<css::uno::XInterface> createInstance(
+ css::uno::Reference<css::uno::XComponentContext> const &
+ context,
+ bool singletonRequest);
+
+ css::uno::Reference<css::uno::XInterface>
+ createInstanceWithArguments(
+ css::uno::Reference<css::uno::XComponentContext> const &
+ context,
+ bool singletonRequest,
+ css::uno::Sequence<css::uno::Any> const & arguments);
+
+ enum Status { STATUS_NEW, STATUS_WRAPPER, STATUS_LOADED };
+
boost::shared_ptr< ImplementationInfo > info;
ImplementationConstructorFn * constructor;
css::uno::Reference< css::lang::XSingleComponentFactory > factory1;
css::uno::Reference< css::lang::XSingleServiceFactory > factory2;
css::uno::Reference< css::lang::XComponent > component;
- bool loaded;
+ Status status;
+
+ osl::Mutex mutex;
+ css::uno::Reference<css::uno::XInterface> singleton;
+ bool dispose;
};
typedef std::map< rtl::OUString, boost::shared_ptr< Implementation > >
@@ -166,7 +184,7 @@ public:
}
void addSingletonContextEntries(
- std::vector< cppu::ContextEntry_Init > * entries) const;
+ std::vector< cppu::ContextEntry_Init > * entries);
css::uno::Reference< css::uno::XComponentContext > getContext() const {
assert(context_.is());
@@ -175,10 +193,7 @@ public:
void loadImplementation(
css::uno::Reference< css::uno::XComponentContext > const & context,
- boost::shared_ptr< Data::ImplementationInfo > const & info,
- ImplementationConstructorFn ** constructor,
- css::uno::Reference< css::lang::XSingleComponentFactory > * factory1,
- css::uno::Reference< css::lang::XSingleServiceFactory > * factory2);
+ boost::shared_ptr< Data::Implementation > & implementation);
private:
virtual ~ServiceManager() {}