diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-10-21 15:17:13 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-11-17 10:49:23 +0100 |
commit | fbf714b45625c50bb1c736ef231b5dbbab0016a1 (patch) | |
tree | 0e1a9e9002a8ce8ca46d7a7071f40c08ffea77e4 /package/inc | |
parent | db5552631b13e5a1d330929cd5093bd0f9894ec8 (diff) |
package: Finally implement parallel zip entries deflating
For that:
1, create ZipPackageStream::successfullyWritten to be called after
the content is written
2, Do not take mutex when reading from WrapStreamForShare - threads should
be using different streams anyway, but there is only one common mutex. :-/
Change-Id: I90303e49206b19454dd4141e24cc8be29c433045
Diffstat (limited to 'package/inc')
-rw-r--r-- | package/inc/ZipOutputEntry.hxx | 3 | ||||
-rw-r--r-- | package/inc/ZipOutputStream.hxx | 7 | ||||
-rw-r--r-- | package/inc/ZipPackageStream.hxx | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/package/inc/ZipOutputEntry.hxx b/package/inc/ZipOutputEntry.hxx index c24d5a905bfe..9e396ce4dc7b 100644 --- a/package/inc/ZipOutputEntry.hxx +++ b/package/inc/ZipOutputEntry.hxx @@ -54,6 +54,9 @@ public: ~ZipOutputEntry(); css::uno::Sequence< sal_Int8 > getData(); + ZipEntry* getZipEntry() { return m_pCurrentEntry; } + ZipPackageStream* getZipPackageStream() { return m_pCurrentStream; } + bool isEncrypt() { return m_bEncryptCurrentEntry; } void closeEntry(); void write(const css::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength); diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx index f11b8833d146..4e8e4ff150be 100644 --- a/package/inc/ZipOutputStream.hxx +++ b/package/inc/ZipOutputStream.hxx @@ -23,10 +23,12 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <ByteChucker.hxx> +#include <comphelper/threadpool.hxx> #include <vector> struct ZipEntry; +class ZipOutputEntry; class ZipPackageStream; class ZipOutputStream @@ -35,14 +37,17 @@ class ZipOutputStream ::std::vector < ZipEntry * > m_aZipList; ByteChucker m_aChucker; - bool m_bFinished; ZipEntry *m_pCurrentEntry; + comphelper::ThreadPool &m_rSharedThreadPool; + std::vector< ZipOutputEntry* > m_aEntries; public: ZipOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > &xOStream ); ~ZipOutputStream(); + void addDeflatingThread( ZipOutputEntry *pEntry, comphelper::ThreadTask *pThreadTask ); + void writeLOC( ZipEntry *pEntry, bool bEncrypt = false ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); void rawWrite( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength ) diff --git a/package/inc/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx index 356d42b78f11..ff6d3db1f6f9 100644 --- a/package/inc/ZipPackageStream.hxx +++ b/package/inc/ZipPackageStream.hxx @@ -63,14 +63,13 @@ private: sal_uInt8 m_nStreamMode; sal_uInt32 m_nMagicalHackPos; sal_uInt32 m_nMagicalHackSize; + sal_Int64 m_nOwnStreamOrigSize; bool m_bHasSeekable; - bool m_bCompressedIsSetFromOutside; - bool m_bFromManifest; - bool m_bUseWinEncoding; + bool m_bRawStream; ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream(); @@ -138,6 +137,7 @@ public: void setZipEntryOnLoading( const ZipEntry &rInEntry); ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData() throw(::com::sun::star::uno::RuntimeException); + void successfullyWritten( ZipEntry *pEntry ); static ::com::sun::star::uno::Sequence < sal_Int8 > static_getImplementationId(); |