[Libreoffice-commits] online.git: loolwsd/MessageQueue.cpp loolwsd/MessageQueue.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Nov 20 00:20:34 UTC 2016


 loolwsd/MessageQueue.cpp |   18 +++++++++++++-----
 loolwsd/MessageQueue.hpp |    1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit c0e3460c68090092ecb0dabc0ab564143728359a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Nov 16 08:47:11 2016 -0500

    loolwsd: MessageQueue cleanup
    
    Change-Id: Iabc4d520dc754fc740f0b94a72237b63a216dd7a
    Reviewed-on: https://gerrit.libreoffice.org/30996
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/MessageQueue.cpp b/loolwsd/MessageQueue.cpp
index 802079c..1a6ce84 100644
--- a/loolwsd/MessageQueue.cpp
+++ b/loolwsd/MessageQueue.cpp
@@ -200,8 +200,11 @@ void TileQueue::deprioritizePreviews()
 
         // stop at the first non-tile or non-'id' (preview) message
         std::string id;
-        if (LOOLProtocol::getFirstToken(message) != "tile" || !LOOLProtocol::getTokenStringFromMessage(message, "id", id))
+        if (LOOLProtocol::getFirstToken(message) != "tile" ||
+            !LOOLProtocol::getTokenStringFromMessage(message, "id", id))
+        {
             break;
+        }
 
         _queue.pop_front();
         _queue.push_back(front);
@@ -243,11 +246,13 @@ MessageQueue::Payload TileQueue::get_impl()
         // avoid starving - stop the search when we reach a non-tile,
         // otherwise we may keep growing the queue of unhandled stuff (both
         // tiles and non-tiles)
-        if (LOOLProtocol::getFirstToken(prio) != "tile" || LOOLProtocol::getTokenStringFromMessage(prio, "id", id))
+        if (LOOLProtocol::getFirstToken(prio) != "tile" ||
+            LOOLProtocol::getTokenStringFromMessage(prio, "id", id))
+        {
             break;
+        }
 
-        int p = priority(prio);
-
+        const int p = priority(prio);
         if (p > prioritySoFar)
         {
             prioritySoFar = p;
@@ -256,7 +261,9 @@ MessageQueue::Payload TileQueue::get_impl()
 
             // found the highest priority already?
             if (prioritySoFar == static_cast<int>(_viewOrder.size()) - 1)
+            {
                 break;
+            }
         }
     }
 
@@ -270,7 +277,8 @@ MessageQueue::Payload TileQueue::get_impl()
     {
         auto& it = _queue[i];
         msg = std::string(it.data(), it.size());
-        if (LOOLProtocol::getFirstToken(msg) != "tile" || LOOLProtocol::getTokenStringFromMessage(msg, "id", id))
+        if (LOOLProtocol::getFirstToken(msg) != "tile" ||
+            LOOLProtocol::getTokenStringFromMessage(msg, "id", id))
         {
             // Don't combine non-tiles or tiles with id.
             ++i;
diff --git a/loolwsd/MessageQueue.hpp b/loolwsd/MessageQueue.hpp
index f330567..96834ae 100644
--- a/loolwsd/MessageQueue.hpp
+++ b/loolwsd/MessageQueue.hpp
@@ -12,6 +12,7 @@
 
 #include <algorithm>
 #include <condition_variable>
+#include <functional>
 #include <deque>
 #include <map>
 #include <mutex>


More information about the Libreoffice-commits mailing list