summaryrefslogtreecommitdiff
path: root/writerfilter/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-05 14:29:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-10 12:31:43 +0200
commit0fb5ca6cc9cc55a4436a36c533461769b1fc8526 (patch)
tree30e21bfcb0a6ad46f52a4e664728753c03d7a837 /writerfilter/inc
parent1a33947a91685808fd5f6d4903b6ae896686066d (diff)
tdf#79877 perf loading docx file, writerfilter/ improvements
this improves load time by 20%. We switch from shared_ptr to tools::SvRef to manage the objects I noticed some double inheritance like this: DomainMapper LoggedProperties Properties SvRefBase LoggedTable Table SvRefBase so to be safe I made all the ref-count-base-class inheritance virtual. Change-Id: Ia3de9733f5c6966e8171f43d083dcc087040b8cd Reviewed-on: https://gerrit.libreoffice.org/57022 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/inc')
-rw-r--r--writerfilter/inc/dmapper/resourcemodel.hxx36
-rw-r--r--writerfilter/inc/ooxml/OOXMLDocument.hxx10
-rw-r--r--writerfilter/inc/ooxml/QNameToString.hxx4
-rw-r--r--writerfilter/inc/rtftok/RTFDocument.hxx4
4 files changed, 24 insertions, 30 deletions
diff --git a/writerfilter/inc/dmapper/resourcemodel.hxx b/writerfilter/inc/dmapper/resourcemodel.hxx
index 116b4192d9be..b2caa3ad97fa 100644
--- a/writerfilter/inc/dmapper/resourcemodel.hxx
+++ b/writerfilter/inc/dmapper/resourcemodel.hxx
@@ -25,6 +25,8 @@
#include <sal/types.h>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Any.hxx>
+#include <tools/ref.hxx>
+
/**
@file resourcemodel.hxx
@@ -76,7 +78,7 @@ namespace writerfilter {
*/
template <class T>
-class SAL_DLLPUBLIC_TEMPLATE Reference
+class SAL_DLLPUBLIC_TEMPLATE Reference : public virtual SvRefBase
{
public:
/**
@@ -85,7 +87,7 @@ public:
@attention The ownership of a reference is transferred when
the reference is passed.
*/
- typedef std::shared_ptr< Reference<T> > Pointer_t;
+ typedef tools::SvRef< Reference<T> > Pointer_t;
/**
Resolves the reference.
@@ -98,7 +100,7 @@ public:
virtual void resolve(T & rHandler) = 0;
protected:
- ~Reference() {}
+ ~Reference() override {}
};
class Value;
@@ -107,7 +109,7 @@ class Sprm;
/**
Handler for properties.
*/
-class Properties
+class Properties : public virtual SvRefBase
{
public:
/**
@@ -126,16 +128,16 @@ public:
virtual void sprm(Sprm & sprm) = 0;
protected:
- ~Properties() {}
+ ~Properties() override {}
};
/**
Handler for tables.
*/
-class Table
+class Table : public virtual SvRefBase
{
public:
- typedef std::shared_ptr<Table> Pointer_t;
+ typedef tools::SvRef<Table> Pointer_t;
/**
Receives an entry of the table.
@@ -146,7 +148,7 @@ public:
virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) = 0;
protected:
- ~Table() {}
+ ~Table() override {}
};
/**
@@ -176,14 +178,14 @@ const sal_uInt8 cFieldEnd = 0x15;
/**
Handler for a stream.
*/
-class Stream
+class Stream : public virtual SvRefBase
{
public:
/**
Pointer to this stream.
*/
- typedef std::shared_ptr<Stream> Pointer_t;
+ typedef tools::SvRef<Stream> Pointer_t;
/**
Receives start mark for group with the same section properties.
@@ -298,7 +300,7 @@ public:
virtual void endGlossaryEntry() = 0;
protected:
- ~Stream() {}
+ ~Stream() override {}
};
/**
@@ -308,15 +310,13 @@ protected:
makes no sense for a certain value, e.g. the integer value of a
string.
*/
-class Value
+class Value : public virtual SvRefBase
{
public:
/**
Pointer to a value.
*/
- typedef std::unique_ptr<Value> Pointer_t;
-
- virtual ~Value() {}
+ typedef tools::SvRef<Value> Pointer_t;
/**
Returns integer representation of the value.
@@ -355,10 +355,10 @@ public:
An SPRM: Section, Paragraph and Run Modifier
*/
-class Sprm
+class Sprm : public virtual SvRefBase
{
public:
- typedef std::unique_ptr<Sprm> Pointer_t;
+ typedef tools::SvRef<Sprm> Pointer_t;
/**
Returns id of the SPRM.
@@ -391,7 +391,7 @@ public:
#endif
protected:
- ~Sprm() {}
+ ~Sprm() override {}
};
typedef sal_Int32 Token_t;
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index 909a5491b59a..124368ee0bc1 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -71,14 +71,12 @@ namespace writerfilter {
namespace ooxml
{
-class OOXMLStream
+class OOXMLStream : public virtual SvRefBase
{
public:
enum StreamType_t { UNKNOWN, DOCUMENT, STYLES, WEBSETTINGS, FONTTABLE, NUMBERING,
FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, VBADATA };
- typedef std::shared_ptr<OOXMLStream> Pointer_t;
-
- virtual ~OOXMLStream() {}
+ typedef tools::SvRef<OOXMLStream> Pointer_t;
/**
Returns fast parser for this stream.
@@ -114,9 +112,7 @@ public:
/**
Pointer to this stream.
*/
- typedef std::shared_ptr<OOXMLDocument> Pointer_t;
-
- virtual ~OOXMLDocument() {}
+ typedef tools::SvRef<OOXMLDocument> Pointer_t;
/**
Resolves this document to a stream handler.
diff --git a/writerfilter/inc/ooxml/QNameToString.hxx b/writerfilter/inc/ooxml/QNameToString.hxx
index 7e6a0b9ec4e2..3508a5f4229e 100644
--- a/writerfilter/inc/ooxml/QNameToString.hxx
+++ b/writerfilter/inc/ooxml/QNameToString.hxx
@@ -29,9 +29,9 @@
namespace writerfilter
{
-class QNameToString
+class QNameToString : public virtual SvRefBase
{
- typedef std::shared_ptr<QNameToString> Pointer_t;
+ typedef tools::SvRef<QNameToString> Pointer_t;
typedef std::map < Id, std::string > Map;
static Pointer_t pInstance;
diff --git a/writerfilter/inc/rtftok/RTFDocument.hxx b/writerfilter/inc/rtftok/RTFDocument.hxx
index f35d337413db..55b1fbee3f4a 100644
--- a/writerfilter/inc/rtftok/RTFDocument.hxx
+++ b/writerfilter/inc/rtftok/RTFDocument.hxx
@@ -26,9 +26,7 @@ class RTFDocument : public writerfilter::Reference<Stream>
{
public:
/// Pointer to this stream.
- using Pointer_t = std::shared_ptr<RTFDocument>;
-
- virtual ~RTFDocument() = default;
+ using Pointer_t = tools::SvRef<RTFDocument>;
/// Resolves this document to a stream handler.
void resolve(Stream& rHandler) override = 0;