diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-24 13:40:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-24 16:09:08 +0200 |
commit | bd44b3eef62f4325a189539d6ab1b90ca63cfc28 (patch) | |
tree | c7acf752ad231602fe05069606df3e5b65caae56 /include | |
parent | 81297c29ceb55dec44999e31a11dea81668c3c8f (diff) |
tdf#89522 PERF FILEOPEN xlsx, part 1
Inherit from tools::WeakBase non-virtually, so that we can use a
static_cast in tools::WeakReference::get instead of a dynamic_cast.
This takes the file-open time from 1m21 to 40s for me.
Add a clang plugin to make sure we don't accidentally end up inheriting
from tools::WeakBase more than once.
Change-Id: I9c7c36403333f99094e1f9d8cce2ecd9200377f9
Reviewed-on: https://gerrit.libreoffice.org/71231
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/svdmodel.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdobj.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdpage.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdtext.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdview.hxx | 2 | ||||
-rw-r--r-- | include/tools/weakbase.hxx | 7 |
6 files changed, 9 insertions, 8 deletions
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 9dad1baa8cc1..e2dc48461c78 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -143,7 +143,7 @@ public: struct SdrModelImpl; -class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase { private: #ifdef DBG_UTIL diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 9de436daa7e8..0d2d836f8efc 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -304,7 +304,7 @@ public: // SwFlyDrawObj /// Abstract DrawObject -class SVX_DLLPUBLIC SdrObject : public SfxListener, public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrObject : public SfxListener, public tools::WeakBase { private: friend class SdrObjListIter; diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 24747bc823a9..d23957dcd906 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -364,7 +364,7 @@ public: // SwDPage // OReportPage -class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase { // #i9076# friend class SdrModel; diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx index 1f96268c7e88..a02d9390ef3e 100644 --- a/include/svx/svdtext.hxx +++ b/include/svx/svdtext.hxx @@ -41,7 +41,7 @@ namespace sdr { namespace properties { */ class SfxStyleSheet; -class SVX_DLLPUBLIC SdrText : public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrText : public tools::WeakBase { public: explicit SdrText( SdrTextObj& rObject ); diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index c0d3b21a8f42..176d6e6146b5 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -146,7 +146,7 @@ public: }; -class SVX_DLLPUBLIC SdrView : public SdrCreateView, public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrView : public SdrCreateView, public tools::WeakBase { friend class SdrPageView; diff --git a/include/tools/weakbase.hxx b/include/tools/weakbase.hxx index 9fe3f32775c3..fa16edd2f147 100644 --- a/include/tools/weakbase.hxx +++ b/include/tools/weakbase.hxx @@ -61,9 +61,10 @@ template< class reference_type > inline reference_type * WeakReference< reference_type >::get() const { auto pWeakBase = mpWeakConnection->mpReference; - auto pRet = dynamic_cast<reference_type *>(pWeakBase); - assert((pWeakBase && pRet) || (!pWeakBase && !pRet)); - return pRet; + if (!pWeakBase) + return nullptr; + assert(dynamic_cast<reference_type *>(pWeakBase)); + return static_cast<reference_type *>(pWeakBase); } template< class reference_type > |