[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - wsd/ClientSession.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 3 06:33:11 UTC 2018


 wsd/ClientSession.cpp |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 8f2ea2eba7fbc58b2e2ab5c154e3c9b7a240f59e
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Oct 1 18:11:25 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Oct 3 08:32:53 2018 +0200

    wsd: Avoid parsing tile messages twice
    
    Change-Id: I049e7ce645999a4d0366ab34ffa75ab0d351947b
    (cherry picked from commit 8a318cc44d0a96bced7c565544c4772cfb936f93)
    Reviewed-on: https://gerrit.libreoffice.org/61211
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 428455f0f..4753db07c 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -13,6 +13,7 @@
 
 #include <fstream>
 #include <sstream>
+#include <memory>
 
 #include <Poco/Net/HTTPResponse.h>
 #include <Poco/StringTokenizer.h>
@@ -1027,15 +1028,16 @@ void ClientSession::enqueueSendMessage(const std::shared_ptr<Message>& data)
         docBroker->assertCorrectThread();
 
     const std::string command = data->firstToken();
+    std::unique_ptr<TileDesc> tile;
     if (command == "tile:")
     {
         // Avoid sending tile if it has the same wireID as the previously sent tile
-        const TileDesc tile = TileDesc::parse(data->firstLine());
-        const std::string tileID = generateTileID(tile);
+        tile.reset(new TileDesc(TileDesc::parse(data->firstLine())));
+        const std::string tileID = generateTileID(*tile);
         auto iter = _oldWireIds.find(tileID);
-        if(iter != _oldWireIds.end() && tile.getWireId() != 0 && tile.getWireId() == iter->second)
+        if(iter != _oldWireIds.end() && tile->getWireId() != 0 && tile->getWireId() == iter->second)
         {
-            LOG_INF("WSD filters out a tile with the same wireID: " <<  tile.serialize("tile:"));
+            LOG_INF("WSD filters out a tile with the same wireID: " <<  tile->serialize("tile:"));
             return;
         }
     }
@@ -1045,10 +1047,9 @@ void ClientSession::enqueueSendMessage(const std::shared_ptr<Message>& data)
     size_t newSize = _senderQueue.enqueue(data);
 
     // Track sent tile
-    if (command == "tile:")
+    if (tile)
     {
-        const TileDesc tile = TileDesc::parse(data->firstLine());
-        traceTileBySend(tile, sizeBefore == newSize);
+        traceTileBySend(*tile, sizeBefore == newSize);
     }
 }
 


More information about the Libreoffice-commits mailing list