summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-11 17:11:06 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-07-16 16:55:54 +0200
commitdb3002eae843056dcfbd6d7ad0ad333ee53251f9 (patch)
tree43edca312cb3f65154f9bf06b220af6d47346fdc /package
parent27d0abe7eca73722980228520f3a3ccdf3f844a3 (diff)
ODT export: handle NoFileSync store option
SfxMedium already had a m_bDisableFileSync member; if the medium has a storage, then forward this flag to it, so at the end SwitchablePersistenceStream::waitForCompletion() (and the called fileaccess::XStream_impl::waitForCompletion()) does not call osl_syncFile(), either. Times for 100 hello world inputs: 12594 -> 5281 ms is spent in XHTML-load + ODT export + close (42% of original). Change-Id: I2aab6c9e6baf133b211620004dcea66bd41ffc6f Reviewed-on: https://gerrit.libreoffice.org/47766 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 16a522361698ea53ab253d67e31cb51802210d71)
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipPackage.hxx1
-rw-r--r--package/source/xstor/xfactory.cxx7
-rw-r--r--package/source/xstor/xstorage.cxx4
-rw-r--r--package/source/zippackage/ZipPackage.cxx4
4 files changed, 14 insertions, 2 deletions
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index f46eb33b0172..1cb3ba7836f5 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -99,6 +99,7 @@ class ZipPackage final : public cppu::WeakImplHelper
const css::uno::Reference < css::uno::XComponentContext > m_xContext;
std::unique_ptr<ZipFile> m_pZipFile;
+ bool m_bDisableFileSync = false;
bool isLocalFile() const;
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index bc956e0e362b..4562dffaafdb 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -223,6 +223,13 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
else
throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
}
+ else if (aDescr[nInd].Name == "NoFileSync")
+ {
+ // Forward NoFileSync to the storage.
+ aPropsToSet.realloc(++nNumArgs);
+ aPropsToSet[nNumArgs - 1].Name = aDescr[nInd].Name;
+ aPropsToSet[nNumArgs - 1].Value = aDescr[nInd].Value;
+ }
else
OSL_FAIL( "Unacceptable property, will be ignored!" );
}
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 48bc0d6aeb04..12a3066fc9d1 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -429,8 +429,10 @@ void OStorage_Impl::OpenOwnPackage()
for ( sal_Int32 aInd = 0; aInd < m_xProperties.getLength(); aInd++ )
{
if ( m_xProperties[aInd].Name == "RepairPackage"
- || m_xProperties[aInd].Name == "ProgressHandler" )
+ || m_xProperties[aInd].Name == "ProgressHandler"
+ || m_xProperties[aInd].Name == "NoFileSync" )
{
+ // Forward these to the package.
beans::NamedValue aNamedValue( m_xProperties[aInd].Name,
m_xProperties[aInd].Value );
aArguments.realloc( ++nArgNum );
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index f7464ed8f30f..346f509d2250 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -728,6 +728,8 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
aNamedValue.Value >>= m_bAllowRemoveOnInsert;
m_xRootFolder->setRemoveOnInsertMode_Impl( m_bAllowRemoveOnInsert );
}
+ else if (aNamedValue.Name == "NoFileSync")
+ aNamedValue.Value >>= m_bDisableFileSync;
// for now the progress handler is not used, probably it will never be
// if ( aNamedValue.Name == "ProgressHandler" )
@@ -1319,7 +1321,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
// in case the stream is based on a file it will implement the following interface
// the call should be used to be sure that the contents are written to the file system
uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor( xTempOut, uno::UNO_QUERY );
- if ( asyncOutputMonitor.is() )
+ if (asyncOutputMonitor.is() && !m_bDisableFileSync)
asyncOutputMonitor->waitForCompletion();
// no need to postpone switching to the new stream since the target was written directly