[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - kit/Kit.cpp wsd/DocumentBroker.cpp wsd/TileCache.cpp
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 11 17:04:06 UTC 2020
kit/Kit.cpp | 12 +++++++++---
wsd/DocumentBroker.cpp | 2 +-
wsd/TileCache.cpp | 24 +++++++++++++-----------
3 files changed, 23 insertions(+), 15 deletions(-)
New commits:
commit cfbb8d56272c9834dc2c416221b00d139b5406ad
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Aug 7 18:37:53 2020 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Aug 11 19:03:46 2020 +0200
Notify WSD of tiles which we didn't need to render.
When we get a wid match, this helps WSD to cleanup its tile
subscriber list effectively.
Change-Id: I6517039fb3d8c9ad8f53aef549b8adbb79961ce1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100348
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100507
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 09b003efc..1eb0ab03f 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1094,6 +1094,9 @@ public:
// The tile content is identical to what the client already has, so skip it
LOG_TRC("Match for tile #" << tileIndex << " at (" << positionX << ',' <<
positionY << ") oldhash==hash (" << hash << "), wireId: " << wireId << " skipping");
+ // Push a zero byte image to inform WSD we didn't need that.
+ // This allows WSD side TileCache to free up waiting subscribers.
+ pushRendered(renderedTiles, tiles[tileIndex], wireId, 0);
tileIndex++;
continue;
}
@@ -1165,13 +1168,16 @@ public:
tileIndex++;
}
+ // empty ones come first
+ size_t zeroCheckStart = renderedTiles.size();
+
_pngPool.run();
- for (auto &i : renderedTiles)
+ for (size_t i = zeroCheckStart; i < renderedTiles.size(); ++i)
{
- if (i.getImgSize() == 0)
+ if (renderedTiles[i].getImgSize() == 0)
{
- LOG_ERR("Encoded 0-sized tile!");
+ LOG_TRC("Encoded 0-sized tile in slot !" << i);
assert(!"0-sized tile enocded!");
}
}
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 03f23c08a..05bd288f8 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1992,7 +1992,7 @@ void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload
try
{
const size_t length = payload.size();
- if (firstLine.size() < static_cast<std::string::size_type>(length) - 1)
+ if (firstLine.size() <= static_cast<std::string::size_type>(length) - 1)
{
const TileCombined tileCombined = TileCombined::parse(firstLine);
const char* buffer = payload.data();
diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp
index e1cdefe8d..982cd985b 100644
--- a/wsd/TileCache.cpp
+++ b/wsd/TileCache.cpp
@@ -175,19 +175,24 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const
{
assertCorrectThread();
- // Save to disk.
+ if (size > 0)
+ {
+ // Save to in-memory cache.
- // Ignore if we can't save the tile, things will work anyway, but slower.
- // An error indication is supposed to be sent to all users in that case.
- saveDataToCache(tile, data, size);
- LOG_TRC("Saved cache tile: " << cacheFileName(tile) << " of size " << size << " bytes");
+ // Ignore if we can't save the tile, things will work anyway, but slower.
+ // An error indication is supposed to be sent to all users in that case.
+ saveDataToCache(tile, data, size);
+ LOG_TRC("Saved cache tile: " << cacheFileName(tile) << " of size " << size << " bytes");
+ }
+ else
+ LOG_TRC("Zero sized cache tile: " << cacheFileName(tile));
// Notify subscribers, if any.
std::shared_ptr<TileBeingRendered> tileBeingRendered = findTileBeingRendered(tile);
if (tileBeingRendered)
{
const size_t subscriberCount = tileBeingRendered->getSubscribers().size();
- if (subscriberCount > 0)
+ if (size > 0 && subscriberCount > 0)
{
std::string response = tile.serialize("tile:");
LOG_DBG("Sending tile message to " << subscriberCount << " subscribers: " << response);
@@ -229,10 +234,9 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const
}
}
}
- else
- {
+ else if (subscriberCount == 0)
LOG_DBG("No subscribers for: " << cacheFileName(tile));
- }
+ // else zero sized
// Remove subscriptions.
if (tileBeingRendered->getVersion() <= tile.getVersion())
@@ -243,9 +247,7 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const
}
}
else
- {
LOG_DBG("No subscribers for: " << cacheFileName(tile));
- }
}
bool TileCache::getTextStream(StreamType type, const std::string& fileName, std::string& content)
More information about the Libreoffice-commits
mailing list