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

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 25 17:24:36 UTC 2019


 desktop/source/lib/init.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 1e1a345a18a4162a7e265cf91bcb0c5dc206d576
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed May 8 21:17:00 2019 -0400
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 25 19:23:46 2019 +0200

    LOK: Minor window event processing cleanup
    
    This reduces the number of json reads we do
    when compressing window events, which happens quite
    often.
    
    (cherry picked from commit 0bb310d7ce39421ecc4ff90518ffdf6aa01d1b02)
    
    Change-Id: I1c85f28867b52cad85445fff8a031b990dad8b56
    Reviewed-on: https://gerrit.libreoffice.org/76321
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 27ae125e4098..2db298e3998c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1336,7 +1336,8 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
 
     boost::property_tree::ptree& aTree = aCallbackData.setJson(payload);
     const unsigned nLOKWindowId = aTree.get<unsigned>("id", 0);
-    if (aTree.get<std::string>("action", "") == "invalidate")
+    const std::string aAction = aTree.get<std::string>("action", "");
+    if (aAction == "invalidate")
     {
         std::string aRectStr = aTree.get<std::string>("rectangle", "");
         // no 'rectangle' field => invalidate all of the window =>
@@ -1347,9 +1348,8 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
                 if (elem.Type == LOK_CALLBACK_WINDOW)
                 {
                     const boost::property_tree::ptree& aOldTree = elem.getJson();
-                    const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 0);
-                    if (aOldTree.get<std::string>("action", "") == "invalidate"
-                        && nLOKWindowId == nOldDialogId)
+                    if (nLOKWindowId == aOldTree.get<unsigned>("id", 0)
+                        && aOldTree.get<std::string>("action", "") == "invalidate")
                     {
                         return true;
                     }
@@ -1368,10 +1368,9 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
                                                 return false;
 
                                             const boost::property_tree::ptree& aOldTree = elem.getJson();
-                                            const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 0);
-                                            return aOldTree.get<std::string>("action", "") == "invalidate" &&
-                                                nLOKWindowId == nOldDialogId &&
-                                                aOldTree.get<std::string>("rectangle", "").empty();
+                                            return nLOKWindowId == aOldTree.get<unsigned>("id", 0)
+                                                && aOldTree.get<std::string>("action", "") == "invalidate"
+                                                && aOldTree.get<std::string>("rectangle", "").empty();
                                         });
 
             // we found a invalidate-all window callback
@@ -1445,6 +1444,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
                 return false;
             });
 
+            // Do not enqueue if redundant.
             if (currentIsRedundant)
             {
                 SAL_INFO("lok.dialog", "Current payload is engulfed by one already in the queue. "
@@ -1458,7 +1458,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
             assert(aCallbackData.validate() && "Validation after setJson failed!");
         }
     }
-    else if (aTree.get<std::string>("action", "") == "created")
+    else if (aAction == "created")
     {
         // Remove all previous actions on same dialog, if we are creating it anew.
         removeAll([&nLOKWindowId](const queue_type::value_type& elem) {
@@ -1471,7 +1471,7 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
             return false;
         });
     }
-    else if (aTree.get<std::string>("action", "") == "size_changed")
+    else if (aAction == "size_changed")
     {
         // A size change is practically re-creation of the window.
         // But at a minimum it's a full invalidation.


More information about the Libreoffice-commits mailing list