diff options
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index a727ec82b70c..0f92d909d525 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -137,6 +137,19 @@ rtl::OUString Databases::expandURL( const rtl::OUString& aURL, Reference< uno::X return aRetURL; } + +// Hold Packages to improve performance (#i106100) +// The PackageManager implementation seems to completely throw away all cached data +// as soon as the last reference to a XPackage dies. Maybe this should be changed. +struct ImplPackageSequenceHolder +{ + Sequence< Reference< deployment::XPackage > > m_aUserPackagesSeq; + Sequence< Reference< deployment::XPackage > > m_aSharedPackagesSeq; +}; + +static ImplPackageSequenceHolder* GpPackageSequenceHolder = NULL; + + Databases::Databases( sal_Bool showBasic, const rtl::OUString& instPath, const com::sun::star::uno::Sequence< rtl::OUString >& imagesZipPaths, @@ -182,6 +195,8 @@ Databases::Databases( sal_Bool showBasic, m_xSFA = Reference< ucb::XSimpleFileAccess >( m_xSMgr->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ), UNO_QUERY_THROW ); + + GpPackageSequenceHolder = new ImplPackageSequenceHolder(); } Databases::~Databases() @@ -230,6 +245,7 @@ Databases::~Databases() } } + delete GpPackageSequenceHolder; } static bool impl_getZipFile( @@ -1525,6 +1541,8 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPack thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("user") ); m_aUserPackagesSeq = xUserManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + if( GpPackageSequenceHolder != NULL ) + GpPackageSequenceHolder->m_aUserPackagesSeq = m_aUserPackagesSeq; m_bUserPackagesLoaded = true; } @@ -1555,6 +1573,8 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("shared") ); m_aSharedPackagesSeq = xSharedManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + if( GpPackageSequenceHolder != NULL ) + GpPackageSequenceHolder->m_aSharedPackagesSeq = m_aSharedPackagesSeq; m_bSharedPackagesLoaded = true; } |