summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-11-06 20:08:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-06 20:28:52 +0100
commitef0e7e146f86999b04d7274688d72fadcaf53a36 (patch)
treed08bb1ebde6f95e4fa988406d87508c80aa2743d /include
parentd81f90dda7100f48995a432b999c1ba76a51846a (diff)
tdf#125688 removing XWeak support from SvXMLImportContext
shaves 2% off the load time Change-Id: Icac00389dfcc3339fe4faf1731e9eeb3ff8d0f0c Reviewed-on: https://gerrit.libreoffice.org/82139 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/xmloff/xmlictxt.hxx32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 9cf531b4eef5..8dc67dac0227 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -24,8 +24,8 @@
#include <xmloff/dllapi.h>
#include <sal/types.h>
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
#include <rtl/ustring.hxx>
-#include <cppuhelper/implbase.hxx>
#include <xmloff/nmspmap.hxx>
#include <memory>
@@ -37,15 +37,20 @@ class SvXMLImportContext;
typedef rtl::Reference<SvXMLImportContext> SvXMLImportContextRef;
-class XMLOFF_DLLPUBLIC SvXMLImportContext : public cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
+/**
+This class deliberately does not support XWeak, to improve performance when loading
+large documents.
+*/
+class XMLOFF_DLLPUBLIC SvXMLImportContext : public css::xml::sax::XFastContextHandler,
+ public css::lang::XTypeProvider
+
{
friend class SvXMLImport;
- SvXMLImport& mrImport;
-
- sal_uInt16 const mnPrefix;
- OUString const maLocalName;
-
+ oslInterlockedCount m_nRefCount;
+ SvXMLImport& mrImport;
+ sal_uInt16 mnPrefix;
+ OUString maLocalName;
std::unique_ptr<SvXMLNamespaceMap> m_pRewindMap;
SAL_DLLPRIVATE std::unique_ptr<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_pRewindMap); }
@@ -74,7 +79,7 @@ public:
* ends. By default, nothing is done.
* Note that virtual methods cannot be used inside destructors. Use
* EndElement instead if this is required. */
- virtual ~SvXMLImportContext() override;
+ virtual ~SvXMLImportContext();
/** Create a children element context. By default, the import's
* CreateContext method is called to create a new default context. */
@@ -115,6 +120,17 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
virtual void SAL_CALL characters(const OUString & aChars) override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) final override;
+ virtual void SAL_CALL acquire() throw () final override
+ { osl_atomic_increment(&m_nRefCount); }
+ virtual void SAL_CALL release() throw () final override
+ { if (osl_atomic_decrement(&m_nRefCount) == 0) delete this; }
+
+ // XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) final override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) final override;
};
#endif // INCLUDED_XMLOFF_XMLICTXT_HXX