wsd/SenderQueue.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
New commits: commit 49af971efbc3dc0c3af8b48f94fba26a037beaaf Author: Ashod Nakashian <[email protected]> Date: Sun Dec 18 14:11:36 2016 -0500 wsd: simplify tile deduplication Change-Id: I34d83acc81b8169d8ae07ed53219b11fe0f0fec2 Reviewed-on: https://gerrit.libreoffice.org/32161 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/wsd/SenderQueue.hpp b/wsd/SenderQueue.hpp index 2864dae..4e1c425 100644 --- a/wsd/SenderQueue.hpp +++ b/wsd/SenderQueue.hpp @@ -175,23 +175,23 @@ private: /// enqueued, otherwise false. bool deduplicate(const Item& item) { + // Deduplicate messages based on the incoming one. const std::string command = item->firstToken(); if (command == "tile:") { - TileDesc newTile = TileDesc::parse(item->firstLine()); - auto begin = std::remove_if(_queue.begin(), _queue.end(), - [&newTile](const queue_item_t& cur) - { - const std::string curCommand = cur->firstToken(); - if (curCommand == "tile:") + // Remove previous identical tile, if any, and use most recent (incoming). + const TileDesc newTile = TileDesc::parse(item->firstLine()); + const auto& pos = std::find_if(_queue.begin(), _queue.end(), + [&newTile](const queue_item_t& cur) { - return (newTile == TileDesc::parse(cur->firstLine())); - } - - return false; - }); + return (cur->firstToken() == "tile:" && + newTile == TileDesc::parse(cur->firstLine())); + }); - _queue.erase(begin, _queue.end()); + if (pos != _queue.end()) + { + _queue.erase(pos); + } } return true; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
