[Libreoffice-commits] core.git: desktop/inc desktop/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 25 12:29:10 UTC 2019


 desktop/inc/lib/init.hxx    |    2 +-
 desktop/source/lib/init.cxx |   21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit d14f10ae64876c394a04fa1ca2b067033a79b0a8
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun May 5 12:57:43 2019 -0400
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 25 14:28:20 2019 +0200

    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 at collabora.co.uk>

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)


More information about the Libreoffice-commits mailing list