diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-05-05 12:57:43 -0400 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-25 14:28:20 +0200 |
commit | d14f10ae64876c394a04fa1ca2b067033a79b0a8 (patch) | |
tree | 2322699a921981c94f8a1cbfab95350e88932f43 /desktop | |
parent | 6fdd0e22fd87b9ac3345e9356129e55c6a393fd5 (diff) |
LOK: Reduce logging while processing events
Change-Id: I8ca457387715fcd085bcbf3107839d2629580f7b
Reviewed-on: https://gerrit.libreoffice.org/76296
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/inc/lib/init.hxx | 2 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 21 |
2 files changed, 16 insertions, 7 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index 013162aa990f..b63794d2a9de 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -130,7 +130,7 @@ namespace desktop { typedef std::vector<CallbackData> queue_type; private: - void removeAll(const std::function<bool (const queue_type::value_type&)>& rTestFunc); + bool removeAll(const std::function<bool (const queue_type::value_type&)>& rTestFunc); queue_type m_queue; std::map<int, std::string> m_states; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7d497f031013..201b5d9c7dfe 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1088,9 +1088,10 @@ void CallbackFlushHandler::queue(const int type, const char* data) case LOK_CALLBACK_GRAPHIC_SELECTION: case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: case LOK_CALLBACK_INVALIDATE_TILES: - SAL_INFO("lok", "Removing dups of [" << type << "]: [" << payload << "]."); - removeAll([type] (const queue_type::value_type& elem) { return (elem.Type == type); }); - break; + if (removeAll( + [type](const queue_type::value_type& elem) { return (elem.Type == type); })) + SAL_INFO("lok", "Removed dups of [" << type << "]: [" << payload << "]."); + break; } } else @@ -1112,7 +1113,9 @@ void CallbackFlushHandler::queue(const int type, const char* data) case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE: case LOK_CALLBACK_RULER_UPDATE: { - removeAll([type] (const queue_type::value_type& elem) { return (elem.Type == type); }); + if (removeAll( + [type](const queue_type::value_type& elem) { return (elem.Type == type); })) + SAL_INFO("lok", "Removed dups of [" << type << "]: [" << payload << "]."); } break; @@ -1489,10 +1492,16 @@ void CallbackFlushHandler::Invoke() } } -void CallbackFlushHandler::removeAll(const std::function<bool (const CallbackFlushHandler::queue_type::value_type&)>& rTestFunc) +bool CallbackFlushHandler::removeAll(const std::function<bool (const CallbackFlushHandler::queue_type::value_type&)>& rTestFunc) { auto newEnd = std::remove_if(m_queue.begin(), m_queue.end(), rTestFunc); - m_queue.erase(newEnd, m_queue.end()); + if (newEnd != m_queue.end()) + { + m_queue.erase(newEnd, m_queue.end()); + return true; + } + + return false; } void CallbackFlushHandler::addViewStates(int viewId) |