summaryrefslogtreecommitdiff
path: root/svl/source/notify
AgeCommit message (Collapse)Author
2020-07-01Fix typosAndrea Gelmini
Change-Id: I4f1c0d90fcb7726ceadd72c9cb9f96a57cade67a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97602 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-07-01tdf#132454 some more improvementsNoel Grandin
Defer moving around the vector by tagging the last bit in the pointer. This takes the undo operation from 10s to 8s on my machine. Also re-organise the fields a little to improve packing. Also add some design notes Change-Id: I38fa9156705c00bb9f64e2fc59ea862eba522942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97424 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-26optimize SvtBroadcaster::Normalize() even a bit more (tdf#132454)Luboš Luňák
Optimize also maDestructedListeners (often just one item). Optimize also small vectors if there's just one item unsorted. Keep the index of the first unsorted item in maListeners, so that it's cheap to find out where the unsorted part starts. This now improves tdf#132454 to 20s. Change-Id: I21a69b440c27a2e31e74fd13b9263f54af12e320 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97198 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-25optimize SvtBroadcaster::Normalize() a bit more (tdf#132454)Luboš Luňák
A common case is just one unsorted item at the end, in that case it's even more efficient to simply insert it in the right place. This further improves the tdf#132454 undo operation 36s->27s. Change-Id: I29db80fb8292e827b655000cddc462cf87cb485d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97088 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2020-06-24optimize SvtBroadcaster::Normalize() (tdf#132454)Luboš Luňák
New items are only appended, so it's wasteful to std::sort() the whole container, just sort the unsorted part (often just one item) and then merge. Change-Id: I20b73730700c279e8f844c0b7a392a8f372a22da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97019 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-23Fix typosAndrea Gelmini
Change-Id: Iba46fbe8559211403118a23cd198a2217b333a81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90900 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2019-06-07tdf#42949 Fix IWYU warnings in svl/Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Except source/svdde/* which is WIN-specific Also recheck include/svl Change-Id: I32d3bcb6b14665c56c07a2f10526329b08c64cbe Reviewed-on: https://gerrit.libreoffice.org/73630 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-16tdf#125254 Performance: A spreadsheet opens too slow, part1Noel Grandin
This takes the opening time from 55s to 48s for me. Change-Id: Ia60fff33e9948e0bd6906c82b48aa30f8b2551bb Reviewed-on: https://gerrit.libreoffice.org/72394 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-16tdf#125254 Performance: A spreadsheet opens too slow, optimise listenerNoel Grandin
saves about 0.5s out of a 43s load And remove the comment in EndListeningAll, SfxBroadcaster::RemoveListener doesn't have any weird side-effects any more Change-Id: Id7c8ac1bed8ff3487cb8f977990d8fac351d7f03 Reviewed-on: https://gerrit.libreoffice.org/72396 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-25Simplify containers iterations in svgio, svl, svtoolsArkadiy Illarionov
Use range-based loop or replace with STL functions Change-Id: I98a3e55a14c8ac00188c5003f84194c2cc6795fb Reviewed-on: https://gerrit.libreoffice.org/63959 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-06try to fix SvtBroadcaster on macOSNoel Grandin
this reverts commit a20ec3b5cd691ae18f0d87d045673ce3a06579c6 fix iterator invalidation assert and commit 4a290888580474f9542f185091bb2a6fcf4e9a53 SvtBroadcaster unify the normal and PrepareForDestruction paths no idea what is going on, I suspect that std::vector is re-allocating its data buffer despite having called reserve() Change-Id: I681ae5fca4578240a2a0dc0af51ff06d919f9099 Reviewed-on: https://gerrit.libreoffice.org/61464 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-05fix iterator invalidation assertNoel Grandin
which only recent versions of MSVC (from 15.8.6) seem to spot. It resulted in PythonTest_sw_python failures with "vector iterators incompatible" assertion on the dest != maDestructedListeners.end() check ever since commit 4a290888580474f9542f185091bb2a6fcf4e9a53 Date: Mon Oct 1 14:31:00 2018 +0200 SvtBroadcaster unify the normal and PrepareForDestruction paths Although this code appears to always have been wrong, it is just that it is being hit much more often now. Change-Id: I45d4f2ceef4ddf19c205702645a41363eea93f21 Reviewed-on: https://gerrit.libreoffice.org/61397 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-02fix bug in SvtListener copy constructorNoel Grandin
it was copying maBroadcasters, without actually starting to listen to those broadcasters, which means if we __did__ call StartListening, that method would have just returned early. Since nothing seems to need this functionality, and it's not obvious what the correct behaviour would be, just don't do the copy. Change-Id: If5865fa3449839758a43ac537475e0a474f39078 Reviewed-on: https://gerrit.libreoffice.org/61239 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-02SvtBroadcaster unify the normal and PrepareForDestruction pathsNoel Grandin
since this approach is better in that it avoids O(n^2) behaviour of lots of listeners deleting from a std::vector, lets just always use this approach. Change-Id: I9204996ee8c9379ac71dfc168a6c1fc653e63a8e Reviewed-on: https://gerrit.libreoffice.org/61204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-02minor optimisation to SvtBroadcaster::AddNoel Grandin
Change-Id: I5ab173cb2517602abc42e715375157fd05fdd55f Reviewed-on: https://gerrit.libreoffice.org/61203 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-02fix bug in SvtBroadcaster copy constructorNoel Grandin
otherwise we end up with duplicated listeners on our list, because we add them twice Change-Id: Ia5cdd3584d49ef11b89cf12fc9ebf07441a47724 Reviewed-on: https://gerrit.libreoffice.org/61202 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-01fix bug in SvtListener::CopyAllBroadcastersNoel Grandin
need to flush existing broadcasters before overwriting Change-Id: If570b838d0313ab7598b36ff8a32fc6d31dea92c Reviewed-on: https://gerrit.libreoffice.org/61151 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-01SvtBroadcaster no need to uniqueNoel Grandin
SvtListener already enforces this Change-Id: I0389668af12013addfdbeec7a5e92a9d374193dc Reviewed-on: https://gerrit.libreoffice.org/61150 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-01scatter some asserts in SvtBroadcasterNoel Grandin
copying a broadcaster that has been marked for destruction is very suspicious. so is adding a listener to such a broadcaster Change-Id: Ic1cae111a600477f16a346004b8017a9a8d242e9 Reviewed-on: https://gerrit.libreoffice.org/61136 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-01don't call back into the SvtBroadcaster when dyingNoel Grandin
and we don't need to use equal_range on a sorted and uniqued vector, lower_bound will do Change-Id: I3f967c04b43432875e3d4de75e6e87bfdef40dc8 Reviewed-on: https://gerrit.libreoffice.org/61135 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-02Add missing sal/log.hxx headersGabor Kelemen
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from stoc to svx Change-Id: If562b1aa1d676d2c1cf513e953238abbb846c65c Reviewed-on: https://gerrit.libreoffice.org/58224 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-15tdf#94792 performance regression for xlsx with chart with >1000 data labelsNoel Grandin
this speeds things up by 30% for me Change-Id: I7fa99e91b0b4f354329803b9c8fab827bd367dac Reviewed-on: https://gerrit.libreoffice.org/55812 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-16ofz#6311 still problems with SdrEdgeObj listening to same obj at start as endCaolán McNamara
Change-Id: Ibd80b484788779b73943b28a5f36e51ebcacec30 Reviewed-on: https://gerrit.libreoffice.org/49821 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-09-06Clean up sal/backtrace.hxxStephan Bergmann
Change-Id: Id78e9c0ca29ff2e52591f3d446431ac23c20ab7a Reviewed-on: https://gerrit.libreoffice.org/41926 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-08-24SAL_INFO->SAL_WARN in lstner.cxx (svl module)Julien Nabet
Since we're already in #ifdef DBG_UTIL, we can also directly use SAL_WARN Change-Id: Ic7c564f6c08e05eb9bd5928ef031f212def094aa Reviewed-on: https://gerrit.libreoffice.org/41531 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-08-17Fix typosAndrea Gelmini
Change-Id: Iaa9c0aea3ea1a239e378bd714ba335f91bb1faf3 Reviewed-on: https://gerrit.libreoffice.org/41194 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2017-08-16assert on duplicate listener in SfxListenerNoel Grandin
To enable finding the source of the duplicate calls, I add new SAL API (only for internal use) to retrieve and symbolise stack backtraces. The theory is that it relatively cheap to just store a backtrace, but quite expense to symbolise it to strings. Note that the backtrace() library we use on Linux does not do a particularly good job, but it gives enough information that developers can use the addr2line tool to get more precise info. Explanation of fixes in the code that triggered the assert: In SwFrameHolder, we need to only call StartListening() if the pFrame member is actually changing. We also need to call EndListening() on the old values when pFrame changes. In SwNavigationPI, there is already a StartListening() call in the only place we assign to m_pCreateView. In ImpEditEngine, we need to ignore duplicates, because it is doing a ref-counting thing. By storing duplicates on the listener list, it doesn't need to keep track of which stylesheets its child nodes are using. Given that it therefore will see duplicate events, there is probably some performance optimisation opportunities here. In MasterPageObserver::Implementation::RegisterDocument, we seem to be getting called multiple times with the same SdDrawDocument, so just check if we've been registered already before calling StartListening() In SvxShape::impl_initFromSdrObject, do the same thing we do elsewhere in this class, i.e. only call StartListening() if the model has changed. Change-Id: I7eae5c774e1e8d56f0ad7bec80e4df0017b287ac Reviewed-on: https://gerrit.libreoffice.org/41045 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-06add COVERITY_NOEXCEPT_FALSECaolán McNamara
to markup dtors that coverity warns might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do Change-Id: I32b94814e8245372e1d1dc36be0d81e3564042f4 Reviewed-on: https://gerrit.libreoffice.org/38318 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-03-25Fix typosAndrea Gelmini
Change-Id: I4eda687db6ad8d41e6a28430c76b288510da605d Reviewed-on: https://gerrit.libreoffice.org/35645 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-17cleanup double includes and declarationsJochen Nitschke
Change-Id: I770e09f48b1a3e8299f59a8e475ba3c18d436d7b Reviewed-on: https://gerrit.libreoffice.org/35312 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-01-18new loplugin: useuniqueptr: svl..svtoolsNoel Grandin
Change-Id: Ia4d5b37ee3cf67318e3cc01525e4b733af60d038 Reviewed-on: https://gerrit.libreoffice.org/33251 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-08convert SFX_HINT to scoped enumNoel Grandin
Notes (*) In SC, BULK_DATACHANGED was or'ed into the hint id. Replaced with a dynamic_cast check. (*) In SC, removed the hint id field from ScIndexHint, no point in storing the hint id twice (*) Fold the SfxStyleSheetHintId enum into the new SfxHintId enum, no point in storing two different hint ids (*) In some cases, multiple #define's used to map to the same SFX_HINT value (notably the SFX_HINT_USER* values). I made all of those separate values. Change-Id: I990e2fb587335ebc51c9005588c6a44f768d9de5 Reviewed-on: https://gerrit.libreoffice.org/31751 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-23perf: eliminate SfxSimpleHint and move to SfxHint, tdf#87101 relatedEike Rathke
There were over 150 places in *::Notify() functions that did some dynamic_cast<SfxSimpleHint*> of which ~98% were unnecessary because the base class SfxHint passed was an SfxSimpleHint anyway. dynamic_cast operations come with quite some cost, so avoid if possible. Specifically for ScFormulaCell::Notify() that created a bottleneck in scenarios where cells were notified that already handled a previous notification. In mass operations doing the dynamic_cast before it could be decided whether having to act on it or not this made 2/3 of all time spent in the Notify() call. To get rid of that rename/move SfxSimpleHint to SfxHint and let classes derive from SfxHint instead of SfxSimpleHint. This comes only with a slight cost that an additional sal_uInt32 is transported in such hints, initialized to 0, but this is neglectable compared to the huge gain. For the rare cases where a Notify() actually expects both, an SfxHint (formerly SfxSimpleHint) and a derived hint, this changed order of the dynamic_cast involved so the simple SfxHint::GetId() is handled last. Modules using such combinations can further optimize by treating the simple SfxHint::GetId() first once verified that none of the other derived hints use an ID not equal to zero respectively none of the ID values the simple hint uses. Change-Id: I9fcf723e3a4487ceb92336189d23a62c344cf0ce Reviewed-on: https://gerrit.libreoffice.org/29205 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2016-03-30Use const_iterator when possible (svl except svdde)Julien Nabet
Change-Id: Ie19467a020d1839146d5a6324e54ccf223d99dd6 Reviewed-on: https://gerrit.libreoffice.org/23603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2016-02-09Remove excess newlinesChris Sherlock
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2015-11-18use unique_ptr for pImpl in svl/Noel Grandin
Change-Id: Ieef897314ac0f056c0a09a5182ca59800fd58f41
2015-11-115th step to remove tools/rtti.hxxOliver Specht
tools/rtti.hxx removed completed the interface of some Sdr.* Items and removed pseudo items Change-Id: I0cdcd01494be35b97a27d5985aa908affa96048a Reviewed-on: https://gerrit.libreoffice.org/19837 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I0f2f81dae91f62639e79799b1bed1b2df1fd79ab
2015-07-06loplugin:unusedmethods svlNoel Grandin
Change-Id: Ic136cce6abef44291b7236a6d709f0eee391f311 Reviewed-on: https://gerrit.libreoffice.org/16784 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-06-29tdf#68016 Write fixture for current behaviour of SfxListenerTobias Lippert
Also: Make destructor of SfxListener more robust, so that it can be used in tests. Change-Id: I02b273ca8e527705c2d3ea3295ed0dec1c4f83ae Reviewed-on: https://gerrit.libreoffice.org/16483 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-06-19tdf#42374 some small optimisations for opening this PDF fileNoel Grandin
makes it about 10% faster Change-Id: I145faed5aa7c312372f08cc651df5afcf10c70ab
2015-05-28new clang plugin: loopvartoosmallNoel Grandin
Idea from bubli - look for loops where the index variable is of such size that it cannot cover the range revealed by examining the length part of the condition. So far, I have only run the plugin up till the VCL module. Also the plugin deliberately excludes anything more complicated than a straightforward incrementing for loop. Change-Id: Ifced18b01c03ea537c64168465ce0b8287a42015
2015-01-26followup code removal after changing virtual methods to non-virtualNoel Grandin
This cleanups up indentation and removes dead classes. This is a followup patch to commit 272b1dd55797aacf511fb4342b0054e3697243f6 "new loplugin: change virtual methods to non-virtual" Change-Id: I1c2139589cf8cb23bb9808defe22c51039d38de1
2015-01-02boost::unordered_map->std::unordered_mapCaolán McNamara
you can get debug stl this way Change-Id: Ia70a3e7c7c452390e8bee34975d296c9318e4a19
2014-12-04pIimplize SfxBroadcaster and SfxListener.Kohei Yoshida
Change-Id: I0d1d73402f11cc61ea9e7629bea34e24c22f5beb
2014-11-25Adjust ref undo to ensure group area listeners are used.Kohei Yoshida
When undoing row deletion (and possibly other similar undo's). And write test for it. Change-Id: I04b4fd9932f4236f124dcd25967355c6055dec33
2014-11-24svl: convert DBG_ASSERTs in SfxListenerMichael Stahl
Change-Id: I07776484277769acf37cb11b8b2cff02c4234d5e
2014-11-18Make these non-inline and add the const version of the getter.Kohei Yoshida
Change-Id: I8c175dcaaa51e2b05895226907697b070a2e2f77
2014-09-30SfxBroadcaster: add some SolarMutex assertsMichael Stahl
It is extremely likely that calling SfxBroadcaster methods without SolarMutex lock is a bug; in case somebody finds a counterexample, this should be reverted. Change-Id: I4706671cfa22a3cfaed9cd33d4a77b14a57bb661
2014-09-06SfxHint: convert home-grown RTTI to normal C++ RTTINoel Grandin
Also note that I fixed a bug in SvxFontMenuControl::Notify where the if statement had the check the wrong way around. Change-Id: I611e8929c65818191e36bd80f2b985820ada4411 Reviewed-on: https://gerrit.libreoffice.org/11147 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>