summaryrefslogtreecommitdiff
path: root/package/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-06-21 10:49:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-22 15:13:05 +0200
commita1cb4c7665f474c9099c734ad3e6a16c9079a6af (patch)
tree2f093df0ce01e3532931381d978f41935e59c6fa /package/inc
parentbe0a41679fea524e0935dc6617b5e65349812dd1 (diff)
reduce allocation in ZipContentInfo map
This is a small struct, no sense in allocating it separately Change-Id: I709daebbde648a79f175f74c207bdf4871ae6ff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117604 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package/inc')
-rw-r--r--package/inc/HashMaps.hxx6
-rw-r--r--package/inc/ZipFile.hxx1
-rw-r--r--package/inc/ZipPackage.hxx1
-rw-r--r--package/inc/ZipPackageFolder.hxx28
4 files changed, 29 insertions, 7 deletions
diff --git a/package/inc/HashMaps.hxx b/package/inc/HashMaps.hxx
index 46df27962cf9..000afa9e3ba2 100644
--- a/package/inc/HashMaps.hxx
+++ b/package/inc/HashMaps.hxx
@@ -20,11 +20,8 @@
#define INCLUDED_PACKAGE_INC_HASHMAPS_HXX
#include "ZipEntry.hxx"
-#include <rtl/ref.hxx>
#include <unordered_map>
-#include <memory>
-
class ZipPackageFolder;
struct ZipContentInfo;
@@ -32,9 +29,6 @@ typedef std::unordered_map < OUString,
ZipPackageFolder * > FolderHash;
typedef std::unordered_map < OUString,
- std::unique_ptr<ZipContentInfo> > ContentHash;
-
-typedef std::unordered_map < OUString,
ZipEntry > EntryHash;
#endif
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 221a89a69d76..01a7b562edcc 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -28,6 +28,7 @@
#include <comphelper/refcountedmutex.hxx>
#include <package/Inflater.hxx>
+#include <rtl/ref.hxx>
#include "ByteGrabber.hxx"
#include "HashMaps.hxx"
#include "EncryptionData.hxx"
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index ec39666fbbb1..64b94ffb8a72 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <comphelper/refcountedmutex.hxx>
+#include <rtl/ref.hxx>
#include "HashMaps.hxx"
#include <osl/file.h>
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index 96d486fc6e3c..6be8063fe27b 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -23,15 +23,41 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include "HashMaps.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include "ZipPackageEntry.hxx"
#include <cppuhelper/implbase.hxx>
#include <string_view>
+#include <unordered_map>
#include <vector>
class ZipOutputStream;
struct ZipEntry;
+class ZipPackageFolder;
+class ZipPackageStream;
+
+struct ZipContentInfo
+{
+ css::uno::Reference < css::lang::XUnoTunnel > xTunnel;
+ bool bFolder;
+ union
+ {
+ ZipPackageFolder *pFolder;
+ ZipPackageStream *pStream;
+ };
+ ZipContentInfo( ZipPackageStream * pNewStream );
+ ZipContentInfo( ZipPackageFolder * pNewFolder );
+ ZipContentInfo( const ZipContentInfo& );
+ ZipContentInfo( ZipContentInfo&& );
+ ZipContentInfo& operator=( const ZipContentInfo& );
+ ZipContentInfo& operator=( ZipContentInfo&& );
+
+ ~ZipContentInfo();
+};
+
+typedef std::unordered_map < OUString,
+ ZipContentInfo > ContentHash;
class ZipPackageFolder : public cppu::ImplInheritanceHelper
<