diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-23 09:26:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-23 14:10:38 +0200 |
commit | 10c934147d469965dba6abc78efd02759a010b8e (patch) | |
tree | 54fe37d01913d48abf93bd087c59f95fdcfa5a46 /sd | |
parent | a08401155a0b4b49878e8e50d39b2fd3e5278779 (diff) |
tdf#113266 slow opening XLS with 45 MB drawing
Some hot-spots around dynamic_cast of SdrHint, so avoid that by creating
special SfxHintId::ThisIsAnSdrHint
The most common CPU hot-spot was in SvxShape::Notify, the other changes
are just for consistency.
Also remove some dead code in ScShapeChildren, the Notify method was
doing nothing useful.
Change-Id: I696db1fcafc09bb10bf23ac673de292746141491
Reviewed-on: https://gerrit.libreoffice.org/71108
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/accessibility/AccessibleSlideSorterView.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/animations/motionpathtag.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/SpellDialogChildWindow.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/sidebar/MasterPageObserver.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsListener.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/tools/EventMultiplexer.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 17 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/view/drawview.cxx | 2 |
11 files changed, 39 insertions, 42 deletions
diff --git a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx index 030c547dde14..27ac7a54376c 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx @@ -163,12 +163,14 @@ namespace accessibility } else { - const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint ); - - if( pSdrHint && ( pSdrHint->GetKind() == SdrHintKind::ModelCleared ) ) + if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { - // model is dying under us, going defunc - bDispose = true; + const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint ); + if( pSdrHint->GetKind() == SdrHintKind::ModelCleared ) + { + // model is dying under us, going defunc + bDispose = true; + } } } diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index 8a2ad2ee7658..7de687968089 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -809,9 +809,9 @@ void AccessibleSlideSorterView::Implementation::Notify ( SfxBroadcaster&, const SfxHint& rHint) { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint); - if (pSdrHint) + if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { + const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint); switch (pSdrHint->GetKind()) { case SdrHintKind::PageOrderChange: diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 0bfcd2dea135..2c0bb805e493 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -387,7 +387,7 @@ void MotionPathTag::updatePathAttributes() void MotionPathTag::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if( !(mpPathObj && !mbInUpdatePath && dynamic_cast< const SdrHint* >( &rHint ) && (mpEffect.get() != nullptr)) ) + if( !(mpPathObj && !mbInUpdatePath && rHint.GetId() == SfxHintId::ThisIsAnSdrHint && (mpEffect.get() != nullptr)) ) return; if( mxPolyPoly != mpPathObj->GetPathPoly() ) diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 327bfd8e731f..86c7a2b7b19b 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -763,9 +763,9 @@ SdTransferable* SdTransferable::getImplementation( const Reference< XInterface > void SdTransferable::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint ); - if( pSdrHint ) + if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { + const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint ); if( SdrHintKind::ModelCleared == pSdrHint->GetKind() ) { EndListening(*mpSourceDoc); diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx index febfef0df28d..c87919346322 100644 --- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx +++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx @@ -110,12 +110,12 @@ void SpellDialogChildWindow::EndSpellingAndClearOutliner() void SpellDialogChildWindow::Notify(SfxBroadcaster&, const SfxHint& rHint) { - if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint)) + if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint) + return; + const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint); + if (SdrHintKind::ModelCleared == pSdrHint->GetKind()) { - if (SdrHintKind::ModelCleared == pSdrHint->GetKind()) - { - EndSpellingAndClearOutliner(); - } + EndSpellingAndClearOutliner(); } } diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx index eee288d021c3..232ea0e3c73e 100644 --- a/sd/source/ui/sidebar/MasterPageObserver.cxx +++ b/sd/source/ui/sidebar/MasterPageObserver.cxx @@ -222,9 +222,9 @@ void MasterPageObserver::Implementation::Notify( SfxBroadcaster& rBroadcaster, const SfxHint& rHint) { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint); - if (!pSdrHint) + if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint) return; + const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint); switch (pSdrHint->GetKind()) { diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index 0971c8ffe60e..0a25ae07c71b 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -267,9 +267,9 @@ void Listener::Notify ( SfxBroadcaster& rBroadcaster, const SfxHint& rHint) { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint); - if (pSdrHint) + if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { + const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint); switch (pSdrHint->GetKind()) { case SdrHintKind::ModelCleared: diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 4184f3ed8dd5..8e44502e341a 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -588,9 +588,9 @@ void EventMultiplexer::Implementation::Notify ( SfxBroadcaster&, const SfxHint& rHint) { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint); - if (pSdrHint) + if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { + const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint); switch (pSdrHint->GetKind()) { case SdrHintKind::ModelCleared: diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 5dbde18870a3..91590534edf3 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -175,14 +175,12 @@ SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable() void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw() { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint ); - - if( pSdrHint ) + if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint) + return; + const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint ); + if( SdrHintKind::ModelCleared == pSdrHint->GetKind() ) { - if( SdrHintKind::ModelCleared == pSdrHint->GetKind() ) - { - mpModel = nullptr; - } + mpModel = nullptr; } } @@ -419,10 +417,9 @@ void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if( mpDoc ) { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint ); - - if( pSdrHint ) + if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { + const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint ); if( hasEventListeners() ) { document::EventObject aEvent; diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index e60b495b2855..88c2c6fb5554 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -75,19 +75,17 @@ SdUnoPageBackground::~SdUnoPageBackground() throw() void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint ); + if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint) + return; + const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint ); - if( pSdrHint ) + // delete item set if document is dying because then the pool + // will also die + if( pSdrHint->GetKind() == SdrHintKind::ModelCleared ) { - // delete item set if document is dying because then the pool - // will also die - if( pSdrHint->GetKind() == SdrHintKind::ModelCleared ) - { - mpSet.reset(); - mpDoc = nullptr; - } + mpSet.reset(); + mpDoc = nullptr; } - } void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw() diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index a86f49a010e3..eb5613c1742b 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -376,7 +376,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { - if ( mpDrawViewShell && dynamic_cast<const SdrHint*>(&rHint) ) + if ( mpDrawViewShell && rHint.GetId() == SfxHintId::ThisIsAnSdrHint ) { SdrHintKind eHintKind = static_cast<const SdrHint&>(rHint).GetKind(); |