[Libreoffice-commits] online.git: wsd/ClientSession.hpp wsd/DocumentBroker.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 20 15:44:04 UTC 2018


 wsd/ClientSession.hpp  |    7 +++----
 wsd/DocumentBroker.cpp |   26 +++++++++++++-------------
 2 files changed, 16 insertions(+), 17 deletions(-)

New commits:
commit cfab70c48bd954bd7707f00f262788194185e018
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Aug 3 14:25:21 2018 +0200
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Aug 20 17:43:44 2018 +0200

    get rid of boost::optional
    
    We don't check if boost is available in the configure phase so we
    can't use it. It is possible to add it but as we only use it in
    one place and it is actually not really needed, it is better to
    remove the usage.
    
    This change also moves the std::list to std::deque.
    
    Change-Id: I4c661a2fb8995bf756a0815a6e30bb304f22d3c8
    Reviewed-on: https://gerrit.libreoffice.org/58640
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index 997058f68..52855abf9 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -17,8 +17,7 @@
 #include "DocumentBroker.hpp"
 #include <Poco/URI.h>
 #include <Rectangle.hpp>
-#include <boost/optional.hpp>
-#include <list>
+#include <deque>
 #include <map>
 #include <unordered_set>
 
@@ -122,7 +121,7 @@ public:
     void setWopiFileInfo(std::unique_ptr<WopiStorage::WOPIFileInfo>& wopiFileInfo) { _wopiFileInfo = std::move(wopiFileInfo); }
 
     /// Get requested tiles waiting for sending to the client
-    boost::optional<std::list<TileDesc>>& getRequestedTiles() { return _requestedTiles; }
+    std::deque<TileDesc>& getRequestedTiles() { return _requestedTiles; }
 
     /// Mark a new tile as sent
     void addTileOnFly(const TileDesc& tile);
@@ -240,7 +239,7 @@ private:
     std::unordered_set<std::string> _tilesBeingRendered;
 
     /// Requested tiles are stored in this list, before we can send them to the client
-    boost::optional<std::list<TileDesc>> _requestedTiles;
+    std::deque<TileDesc> _requestedTiles;
 
     /// Store wireID's of the sent tiles inside the actual visible area
     std::map<std::string, TileWireId> _oldWireIds;
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index be5c3aae4..2bd5b5d02 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1320,17 +1320,17 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined,
     }
 
     // Accumulate tiles
-    boost::optional<std::list<TileDesc>>& requestedTiles = session->getRequestedTiles();
-    if(requestedTiles == boost::none)
+    std::deque<TileDesc>& requestedTiles = session->getRequestedTiles();
+    if (requestedTiles.empty())
     {
-        requestedTiles = std::list<TileDesc>(tileCombined.getTiles().begin(), tileCombined.getTiles().end());
+        requestedTiles = std::deque<TileDesc>(tileCombined.getTiles().begin(), tileCombined.getTiles().end());
     }
     // Drop duplicated tiles, but use newer version number
     else
     {
         for (const auto& newTile : tileCombined.getTiles())
         {
-            const TileDesc& firstOldTile = *(requestedTiles.get().begin());
+            const TileDesc& firstOldTile = *(requestedTiles.begin());
             if(newTile.getPart() != firstOldTile.getPart() ||
                newTile.getWidth() != firstOldTile.getWidth() ||
                newTile.getHeight() != firstOldTile.getHeight() ||
@@ -1341,7 +1341,7 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined,
             }
 
             bool tileFound = false;
-            for (auto& oldTile : requestedTiles.get())
+            for (auto& oldTile : requestedTiles)
             {
                 if(oldTile.getTilePosX() == newTile.getTilePosX() &&
                    oldTile.getTilePosY() == newTile.getTilePosY() )
@@ -1354,7 +1354,7 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined,
                 }
             }
             if(!tileFound)
-                requestedTiles.get().push_back(newTile);
+                requestedTiles.push_back(newTile);
         }
     }
 
@@ -1381,14 +1381,13 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
 
     // All tiles were processed on client side what we sent last time, so we can send a new banch of tiles
     // which was invalidated / requested in the meantime
-    boost::optional<std::list<TileDesc>>& requestedTiles = session->getRequestedTiles();
-    if(requestedTiles != boost::none && !requestedTiles.get().empty())
+    std::deque<TileDesc>& requestedTiles = session->getRequestedTiles();
+    if (!requestedTiles.empty())
     {
         std::vector<TileDesc> tilesNeedsRendering;
-        while(session->getTilesOnFlyCount() + session->getTilesBeingRenderedCount() < tilesOnFlyUpperLimit
-              && !requestedTiles.get().empty())
+        while(session->getTilesOnFlyCount() + session->getTilesBeingRenderedCount() < tilesOnFlyUpperLimit)
         {
-            TileDesc& tile = *(requestedTiles.get().begin());
+            TileDesc& tile = *(requestedTiles.begin());
 
             // Satisfy as many tiles from the cache.
             std::unique_ptr<std::fstream> cachedTile = _tileCache->lookupTile(tile);
@@ -1425,7 +1424,7 @@ void DocumentBroker::sendRequestedTiles(const std::shared_ptr<ClientSession>& se
                 _debugRenderedTileCount++;
                 tileCache().subscribeToTileRendering(tile, session);
             }
-            requestedTiles.get().pop_front();
+            requestedTiles.pop_front();
         }
 
         // Send rendering request for those tiles which were not prerendered
@@ -1447,7 +1446,8 @@ void DocumentBroker::cancelTileRequests(const std::shared_ptr<ClientSession>& se
 
     // Clear tile requests
     session->clearTilesOnFly();
-    session->getRequestedTiles() = boost::none;
+
+    session->getRequestedTiles().clear();
 
     session->clearTileSubscription();
 


More information about the Libreoffice-commits mailing list