loolwsd/MessageQueue.cpp | 52 ++++++++++++++++++++++++++++------------------- loolwsd/TileCache.cpp | 4 ++- 2 files changed, 34 insertions(+), 22 deletions(-)
New commits: commit 9e5df31cbb2b2aeeb5c4bdbf260307d0a027703e Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Tue Sep 20 19:20:23 2016 -0400 loolwsd: make sure to combine all contiguous tiles Change-Id: If65e2ff53f593015ba7df23b6943a711c36550de Reviewed-on: https://gerrit.libreoffice.org/29119 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/MessageQueue.cpp b/loolwsd/MessageQueue.cpp index 16946e2..7e81608 100644 --- a/loolwsd/MessageQueue.cpp +++ b/loolwsd/MessageQueue.cpp @@ -214,35 +214,45 @@ MessageQueue::Payload TileQueue::get_impl() tiles.emplace_back(TileDesc::parse(msg)); // Combine as many tiles as possible with the top one. - for (size_t i = 0; i < _queue.size(); ) + bool added; + do { - auto& it = _queue[i]; - msg = std::string(it.data(), it.size()); - if (msg.compare(0, 5, "tile ") != 0 || - msg.find("id=") != std::string::npos) + added = false; + for (size_t i = 0; i < _queue.size(); ) { - // Don't combine non-tiles or tiles with id. - continue; - } + auto& it = _queue[i]; + msg = std::string(it.data(), it.size()); + if (msg.compare(0, 5, "tile ") != 0 || + msg.find("id=") != std::string::npos) + { + // Don't combine non-tiles or tiles with id. + ++i; + continue; + } - auto tile2 = TileDesc::parse(msg); - bool found = false; - Log::trace() << "combining?: " << msg << Log::end; + auto tile2 = TileDesc::parse(msg); + Log::trace() << "combining?: " << msg << Log::end; - // Check if adjacent tiles. - for (auto& tile : tiles) - { - if (tile.isAdjacent(tile2)) + // Check if adjacent tiles. + bool found = false; + for (auto& tile : tiles) { - tiles.emplace_back(tile2); - _queue.erase(_queue.begin() + i); - found = true; - break; + if (tile.isAdjacent(tile2)) + { + tiles.emplace_back(tile2); + _queue.erase(_queue.begin() + i); + found = true; + added = true; + break; + } } - } - i += !found; + i += !found; + } } + while (added); + + Log::trace() << "Combined " << tiles.size() << " tiles, leaving " << _queue.size() << " in queue." << Log::end; if (tiles.size() == 1) { diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp index a5f7c0f..a439a63 100644 --- a/loolwsd/TileCache.cpp +++ b/loolwsd/TileCache.cpp @@ -477,11 +477,13 @@ int TileCache::subscribeToTileRendering(const TileDesc& tile, const std::shared_ std::string TileCache::cancelTiles(const std::shared_ptr<ClientSession> &subscriber) { + assert(subscriber && "cancelTiles expects valid subscriber"); + Log::trace("Cancelling tiles for " + subscriber->getName()); + std::unique_lock<std::mutex> lock(_tilesBeingRenderedMutex); const auto sub = subscriber.get(); - Log::trace("Cancelling tiles for " + subscriber->getName()); std::ostringstream oss; for (auto it = _tilesBeingRendered.begin(); it != _tilesBeingRendered.end(); ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits