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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Sep 26 02:36:56 UTC 2016


 loolwsd/DocumentBroker.cpp |   31 ++++++-------------------------
 loolwsd/DocumentBroker.hpp |    2 --
 2 files changed, 6 insertions(+), 27 deletions(-)

New commits:
commit 9d883bfc71e66a534f3a03205c9a5054c21b4a03
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Sep 25 11:33:31 2016 -0400

    Revert "bccu#2018 - Missing tiles when finished typing"
    
    This reverts commit 342125b8ead18ac79dd644063e58496afd5d7d38.
    
    Change-Id: I2f509f5044b7a432c978138e31edef679f2aca78
    Reviewed-on: https://gerrit.libreoffice.org/29280
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index f55f3ed..c241594 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -112,8 +112,7 @@ DocumentBroker::DocumentBroker() :
     _cursorHeight(0),
     _isLoaded(false),
     _isModified(false),
-    _tileVersion(0),
-    _invalidatedTileVersion(0)
+    _tileVersion(0)
 {
     Log::info("Empty DocumentBroker (marked to destroy) created.");
 }
@@ -136,8 +135,7 @@ DocumentBroker::DocumentBroker(const Poco::URI& uriPublic,
     _cursorHeight(0),
     _isLoaded(false),
     _isModified(false),
-    _tileVersion(0),
-    _invalidatedTileVersion(0)
+    _tileVersion(0)
 {
     assert(!_docKey.empty());
     assert(!_childRoot.empty());
@@ -472,9 +470,8 @@ void DocumentBroker::invalidateTiles(const std::string& tiles)
     // Remove from cache.
     _tileCache->invalidateTiles(tiles);
 
-    // Any older tile than this (inclusive) is not to be trusted.
-    _invalidatedTileVersion = _tileVersion;
-    Log::trace("Last invalidated tile version: " + std::to_string(_invalidatedTileVersion));
+    //TODO: Re-issue the tiles again to avoid races.
+
 }
 
 void DocumentBroker::handleTileRequest(TileDesc& tile,
@@ -591,14 +588,6 @@ void DocumentBroker::handleTileResponse(const std::vector<char>& payload)
     {
         auto tile = TileDesc::parse(firstLine);
 
-        bool cache = true;
-        if (_invalidatedTileVersion > 0 && tile.getVersion() <= _invalidatedTileVersion)
-        {
-            // Drop from the cache, but forward to clients nontheless.
-            Log::info() << "Dropping potentially invalidated tile (cutoff "
-                        << _invalidatedTileVersion << "): " << firstLine << Log::end;
-            cache = false;
-        }
 
         const auto length = payload.size();
         if (firstLine.size() < static_cast<std::string::size_type>(length) - 1)
@@ -606,7 +595,7 @@ void DocumentBroker::handleTileResponse(const std::vector<char>& payload)
             const auto buffer = payload.data();
             tileCache().notifySubscribers(
                 tile, buffer + firstLine.size() + 1,
-                length - firstLine.size() - 1, cache);
+                length - firstLine.size() - 1, true);
         }
         else
         {
@@ -632,14 +621,6 @@ void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload
     {
         auto tileCombined = TileCombined::parse(firstLine);
 
-        bool cache = true;
-        if (_invalidatedTileVersion > 0 && tileCombined.getVersion() <= _invalidatedTileVersion)
-        {
-            // Drop from the cache, but forward to clients nontheless.
-            Log::info() << "Dropping potentially invalidated tile (cutoff "
-                        << _invalidatedTileVersion << "): " << firstLine << Log::end;
-            cache = false;
-        }
 
         const auto length = payload.size();
         if (firstLine.size() < static_cast<std::string::size_type>(length) - 1)
@@ -648,7 +629,7 @@ void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload
             auto offset = firstLine.size() + 1;
             for (const auto& tile : tileCombined.getTiles())
             {
-                tileCache().notifySubscribers(tile, buffer + offset, tile.getImgSize(), cache);
+                tileCache().notifySubscribers(tile, buffer + offset, tile.getImgSize(), true);
                 offset += tile.getImgSize();
             }
         }
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 29330c8..a547a32 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -267,8 +267,6 @@ private:
     /// Versioning is used to prevent races between
     /// painting and invalidation.
     std::atomic<size_t> _tileVersion;
-    /// The last version number when invalidation happened.
-    std::atomic<int> _invalidatedTileVersion;
 
     static constexpr auto IdleSaveDurationMs = 30 * 1000;
     static constexpr auto AutoSaveDurationMs = 300 * 1000;


More information about the Libreoffice-commits mailing list