https://bugs.freedesktop.org/show_bug.cgi?id=74608
Priority: medium
Bug ID: 74608
Assignee: [email protected]
Summary: Constructor functions for UNO component
implementations
Severity: normal
Classification: Unclassified
OS: All
Reporter: [email protected]
Hardware: Other
Status: UNCONFIRMED
Version: unspecified
Component: Libreoffice
Product: LibreOffice
Currently instantiating an UNO service implementation is a long process.
First we call foo_component_getFactory(), where we create the right factory,
which then creates the c++ object.
Instead, the new way, is to call just foo_get_implementation function which
directly creates the c++ object.
This task is about splitting foo_component_getFactory functions to have an
exported function for each implementation it contains.
This simplifies the process and makes it a bit faster.
Additionally, helps us to select and use only implementations we need for e.g.
mobile platforms or anything compiled as one big library / executable and
allows the instantiation to be even faster.
To work on this, just choose a component, e.g. xmloff/util/xo.component
1, Find a implementation in there you want to covert, e.g. <implementation
name="XMLVersionListPersistence">
2, Add a constructor name for it, e.g.
constructor="XMLVersionListPersistence_get_implementation"
2, git grep for its implementation and/or service name in the module (xmloff in
this case) to find the c++ class implementation: XMLVersionListPersistence.
3, Remove its use from xo_component_getFactory.
4, Add new function which looks as:
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
XMLVersionListPersistence_get_implementation(
css::uno::XComponentContext *,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new XMLVersionListPersistence());
}
You may need to use the XComponentContext variable.
5, Remove any static methods which were previously used in
foo_component_getFactory : There should be now at most one function using them,
so move the code there.
Best to look at examples:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=1790ff71bd0772a37ad6ab7885cdbe2752dfdadf
http://cgit.freedesktop.org/libreoffice/core/commit/?id=fe537786a42abea57551395f73328db48bebd086
Optionally, if it's possible, move the code to anonymous namespace, as in
http://cgit.freedesktop.org/libreoffice/core/commit/?id=ed9e1e739041c8ef30e68559e9e9415632b21d94
You can do that in one commit.
Another example:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=1d77f5ce5e13720d46b41fd3ee4c7fe1d92a9839
Unfortunately, every module looks different, but once you get used to it, it's
easy, just don't be afraid to start and ask if in doubt.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs