diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-03 10:03:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-04 09:35:00 +0200 |
commit | 77219c88ac0a44b3ed5dada67d0d9ca52fa3adec (patch) | |
tree | b7b8cc3cf4dce7d3fdbddb38ae71d086a4b087ad /sfx2 | |
parent | 6fdd1dc34f497fce28f85807126e56432a3cb7d2 (diff) |
tdf#67538 XTypeDetection::queryTypeByDescriptor poor performance, part2
SfxMedium was creating a temporary file and copying the input file, when
CloseInStream_Impl was called from the destructor. Very very bad for
performance.
This is specifically fixing the performance of queryTypeByDescriptor
when called from a basic macro on a local test file.
This takes my test macro from 16.1s to 9s.
Change-Id: If52f8e0587c7b11666893f6cb79b3180d45cce43
Reviewed-on: https://gerrit.libreoffice.org/73375
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit c0d372d7c0d9284aad8b0d5142dff7c34c062fa9)
Reviewed-on: https://gerrit.libreoffice.org/73399
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 177104414099..265fd4edd5b4 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -593,7 +593,7 @@ void SfxMedium::CloseInStream() CloseInStream_Impl(); } -void SfxMedium::CloseInStream_Impl() +void SfxMedium::CloseInStream_Impl(bool bInDestruction) { // if there is a storage based on the InStream, we have to // close the storage, too, because otherwise the storage @@ -604,7 +604,7 @@ void SfxMedium::CloseInStream_Impl() CloseStorage(); } - if ( pImpl->m_pInStream && !GetContent().is() ) + if ( pImpl->m_pInStream && !GetContent().is() && !bInDestruction ) { CreateTempFile(); return; @@ -2905,14 +2905,14 @@ sal_uInt32 SfxMedium::CreatePasswordToModifyHash( const OUString& aPasswd, bool } -void SfxMedium::Close() +void SfxMedium::Close(bool bInDestruction) { if ( pImpl->xStorage.is() ) { CloseStorage(); } - CloseStreams_Impl(); + CloseStreams_Impl(bInDestruction); UnlockFile( false ); } @@ -3081,9 +3081,9 @@ void SfxMedium::CloseAndReleaseStreams_Impl() } -void SfxMedium::CloseStreams_Impl() +void SfxMedium::CloseStreams_Impl(bool bInDestruction) { - CloseInStream_Impl(); + CloseInStream_Impl(bInDestruction); CloseOutStream_Impl(); if ( pImpl->m_pSet ) @@ -3326,7 +3326,7 @@ SfxMedium::~SfxMedium() // if there is a requirement to clean the backup this is the last possibility to do it ClearBackup_Impl(); - Close(); + Close(/*bInDestruction*/true); if( !pImpl->bIsTemp || pImpl->m_aName.isEmpty() ) return; |