summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2009-12-02 11:02:22 +0100
committerJoachim Lingner <jl@openoffice.org>2009-12-02 11:02:22 +0100
commit3c1928abb4a9b37eb02634ff5603291104d45c2c (patch)
tree4a347474295758081cf3968bc102e648d4bd7e26 /desktop
parentef1ec7001a06a6ba0fdbed702bcd7a6fec58eaf9 (diff)
jl145: #107371# make getDeployedPackages faster. Caching XPackages in back ends
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx6
-rw-r--r--desktop/source/deployment/registry/inc/dp_backend.h14
2 files changed, 13 insertions, 7 deletions
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index aa67536bd425..f5149458ad58 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -137,7 +137,7 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage(
{
::osl::ResettableMutexGuard guard( getMutex() );
check();
- t_string2weakref::const_iterator const iFind( m_bound.find( url ) );
+ t_string2ref::const_iterator const iFind( m_bound.find( url ) );
if (iFind != m_bound.end()) {
Reference<deployment::XPackage> xPackage( iFind->second );
if (xPackage.is())
@@ -169,8 +169,8 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage(
}
guard.reset();
- ::std::pair< t_string2weakref::iterator, bool > insertion(
- m_bound.insert( t_string2weakref::value_type( url, xNewPackage ) ) );
+ ::std::pair< t_string2ref::iterator, bool > insertion(
+ m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) );
if (insertion.second)
{ // first insertion
OSL_ASSERT( Reference<XInterface>(insertion.first->second)
diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h
index 256d4680d795..86ac2a0194cf 100644
--- a/desktop/source/deployment/registry/inc/dp_backend.h
+++ b/desktop/source/deployment/registry/inc/dp_backend.h
@@ -247,11 +247,17 @@ class PackageRegistryBackend
: protected ::dp_misc::MutexHolder, public t_BackendBase
{
::rtl::OUString m_cachePath;
-
+ //The map held originally WeakReferences. The map entries are removed in the disposing
+ //function, which is called when the XPackages are destructed or they are
+ //explicitely disposed. The latter happens, for example, when a extension is
+ //removed (see dp_manager.cxx). However, because of how the help systems work, now
+ // XPackageManager::getDeployedPackages is called often. This results in a lot
+ //of bindPackage calls which are costly. Therefore we keep hard references in
+ //the map now.
typedef ::std::hash_map<
- ::rtl::OUString, css::uno::WeakReference<css::deployment::XPackage>,
- ::rtl::OUStringHash > t_string2weakref;
- t_string2weakref m_bound;
+ ::rtl::OUString, css::uno::Reference<css::deployment::XPackage>,
+ ::rtl::OUStringHash > t_string2ref;
+ t_string2ref m_bound;
protected:
css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;