[Libreoffice-commits] online.git: test/TileQueueTests.cpp wsd/DocumentBroker.cpp wsd/TileDesc.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Nov 28 05:28:15 UTC 2016


 test/TileQueueTests.cpp |   17 ++++++++++-------
 wsd/DocumentBroker.cpp  |   24 +++++++++++++++---------
 wsd/TileDesc.hpp        |    3 +--
 3 files changed, 26 insertions(+), 18 deletions(-)

New commits:
commit b8c9163ac8ddfcc3035e95013a34fa0fe2315c80
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Nov 27 21:28:21 2016 -0500

    loolwsd: combine tiles strictly in the same row only
    
    Change-Id: I1d2ba647deac8da749e7cf7b56a1c9a19fe840f8
    Reviewed-on: https://gerrit.libreoffice.org/31299
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/test/TileQueueTests.cpp b/test/TileQueueTests.cpp
index dea692b..0491468 100644
--- a/test/TileQueueTests.cpp
+++ b/test/TileQueueTests.cpp
@@ -109,24 +109,27 @@ void TileQueueTests::testTileCombinedRendering()
 
     const std::string resHor = "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 tileheight=3840";
     const TileQueue::Payload payloadHor(resHor.data(), resHor.data() + resHor.size());
-    const std::string resVer = "tilecombine part=0 width=256 height=256 tileposx=0,0 tileposy=0,3840 imgsize=0,0 tilewidth=3840 tileheight=3840";
-    const TileQueue::Payload payloadVer(resVer.data(), resVer.data() + resVer.size());
-    const std::string resFull = "tilecombine part=0 width=256 height=256 tileposx=0,3840,0 tileposy=0,0,3840 imgsize=0,0,0 tilewidth=3840 tileheight=3840";
+    const std::string resVer1 = "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 ver=-1";
+    const TileQueue::Payload payloadVer1(resVer1.data(), resVer1.data() + resVer1.size());
+    const std::string resVer2 = "tile part=0 width=256 height=256 tileposx=0 tileposy=3840 tilewidth=3840 tileheight=3840 ver=-1";
+    const TileQueue::Payload payloadVer2(resVer2.data(), resVer2.data() + resVer2.size());
+    const std::string resFull = "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 tileheight=3840";
     const TileQueue::Payload payloadFull(resFull.data(), resFull.data() + resFull.size());
 
     TileQueue queue;
 
-    // Horizontal.
+    // Horizontal - combine both.
     queue.put(req1);
     queue.put(req2);
     CPPUNIT_ASSERT_EQUAL(payloadHor, queue.get());
 
-    // Vertical.
+    // Vertical - not combined.
     queue.put(req1);
     queue.put(req3);
-    CPPUNIT_ASSERT_EQUAL(payloadVer, queue.get());
+    CPPUNIT_ASSERT_EQUAL(payloadVer1, queue.get());
+    CPPUNIT_ASSERT_EQUAL(payloadVer2, queue.get());
 
-    // Vertical.
+    // Vertical - combine first row only.
     queue.put(req1);
     queue.put(req2);
     queue.put(req3);
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 886cf98..ed5b726 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -591,18 +591,24 @@ size_t DocumentBroker::removeSession(const std::string& id)
 {
     Util::assertIsLocked(_mutex);
 
-    auto it = _sessions.find(id);
-    if (it != _sessions.end())
+    try
     {
-        _sessions.erase(it);
+        Admin::instance().rmDoc(_docKey, id);
 
-        // Let the child know the client has disconnected.
-        const std::string msg("child-" + id + " disconnect");
-        _childProcess->sendTextFrame(msg);
-    }
+        auto it = _sessions.find(id);
+        if (it != _sessions.end())
+        {
+            _sessions.erase(it);
 
-    // Lets remove this session from the admin console too
-    Admin::instance().rmDoc(_docKey, id);
+            // Let the child know the client has disconnected.
+            const std::string msg("child-" + id + " disconnect");
+            _childProcess->sendTextFrame(msg);
+        }
+    }
+    catch (const std::exception& ex)
+    {
+        LOG_ERR("Error while removing session [" << id << "]: " << ex.what());
+    }
 
     return _sessions.size();
 }
diff --git a/wsd/TileDesc.hpp b/wsd/TileDesc.hpp
index 765341d..3e12408 100644
--- a/wsd/TileDesc.hpp
+++ b/wsd/TileDesc.hpp
@@ -104,8 +104,7 @@ public:
             return false;
         }
 
-        return other.getTilePosY() + other.getTileHeight() >= getTilePosY() &&
-               other.getTilePosY() <= getTilePosY() + getTileHeight();
+        return other.getTilePosY() == getTilePosY();
     }
 
     /// Serialize this instance into a string.


More information about the Libreoffice-commits mailing list