[Libreoffice-commits] online.git: 2 commits - loolwsd/MessageQueue.cpp loolwsd/MessageQueue.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Sep 26 02:49:57 UTC 2016
loolwsd/MessageQueue.cpp | 30 +-----------------------------
loolwsd/MessageQueue.hpp | 39 ++++++++++++---------------------------
2 files changed, 13 insertions(+), 56 deletions(-)
New commits:
commit d9c90e30fd9f02a7287183d2b58195f547fb92da
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Sep 25 12:38:17 2016 -0400
loolwsd: move the editing view to the front
Swapping the views makes the current front
go to some random location, which isn't fair.
Change-Id: I147aceb6bc5e5eb751a86d557d72ecdedb34af23
Reviewed-on: https://gerrit.libreoffice.org/29286
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/MessageQueue.hpp b/loolwsd/MessageQueue.hpp
index 07df61d..0edbe2d 100644
--- a/loolwsd/MessageQueue.hpp
+++ b/loolwsd/MessageQueue.hpp
@@ -97,22 +97,24 @@ public:
_cursorPositions[viewId] = cursorPosition;
}
- auto view = std::find(_viewOrder.begin(), _viewOrder.end(), viewId);
+ // Move to front, so the current front view
+ // becomes the second.
+ const auto view = std::find(_viewOrder.begin(), _viewOrder.end(), viewId);
if (view != _viewOrder.end())
{
- std::swap(_viewOrder.front(), *view);
- }
- else
- {
- _viewOrder.push_front(viewId);
+ _viewOrder.erase(view);
}
+
+ _viewOrder.push_front(viewId);
}
void removeCursorPosition(int viewId)
{
- auto it = std::find(_viewOrder.begin(), _viewOrder.end(), viewId);
- if (it != _viewOrder.end())
- _viewOrder.erase(it);
+ const auto view = std::find(_viewOrder.begin(), _viewOrder.end(), viewId);
+ if (view != _viewOrder.end())
+ {
+ _viewOrder.erase(view);
+ }
_cursorPositions.erase(viewId);
}
commit 552a8a6f9b89196e40f37ec23a782a745a43de2e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Sep 25 11:50:01 2016 -0400
loolwsd: removed BasicTileQueue which served no purpose
Change-Id: If0a768dcc71e6a9957f52abe1f44b242ab3c836f
Reviewed-on: https://gerrit.libreoffice.org/29285
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/MessageQueue.cpp b/loolwsd/MessageQueue.cpp
index 01f06ac..da1bfba 100644
--- a/loolwsd/MessageQueue.cpp
+++ b/loolwsd/MessageQueue.cpp
@@ -74,34 +74,6 @@ void MessageQueue::clear_impl()
_queue.clear();
}
-void BasicTileQueue::put_impl(const Payload& value)
-{
- const auto msg = std::string(&value[0], value.size());
- if (msg == "canceltiles")
- {
- Log::error("Unexpected canceltiles!");
-
- // remove all the existing tiles from the queue
- _queue.erase(std::remove_if(_queue.begin(), _queue.end(),
- [](const Payload& v)
- {
- // must not remove the tiles with 'id=', they are special, used
- // eg. for previews etc.
- const auto tmp = std::string(&v[0], v.size());
- return (tmp.compare(0, 5, "tile ") == 0) && (tmp.find("id=") == std::string::npos);
- }
- ),
- _queue.end());
-
- // put the "canceltiles" in front of other messages
- _queue.push_front(value);
- }
- else
- {
- MessageQueue::put_impl(value);
- }
-}
-
void TileQueue::put_impl(const Payload& value)
{
const auto msg = std::string(value.data(), value.size());
@@ -163,7 +135,7 @@ void TileQueue::put_impl(const Payload& value)
}
}
- BasicTileQueue::put_impl(value);
+ MessageQueue::put_impl(value);
}
bool TileQueue::priority(const std::string& tileMsg)
diff --git a/loolwsd/MessageQueue.hpp b/loolwsd/MessageQueue.hpp
index 11bad5f..07df61d 100644
--- a/loolwsd/MessageQueue.hpp
+++ b/loolwsd/MessageQueue.hpp
@@ -66,26 +66,9 @@ protected:
std::deque<Payload> _queue;
};
-/** MessageQueue specialized for handling of tiles.
-
-Used for basic handling of incoming requests, only can remove tiles when it
-gets a "canceltiles" command.
-*/
-class BasicTileQueue : public MessageQueue
-{
-protected:
- virtual void put_impl(const Payload& value) override;
-};
-
/** MessageQueue specialized for priority handling of tiles.
-
-This class builds on BasicTileQueue, and additonaly provides de-duplication
-of tile requests.
-
-TODO: we'll need to add reordering of the tiles at some stage here too - so
-that the ones closest to the cursor position are returned first.
*/
-class TileQueue : public BasicTileQueue
+class TileQueue : public MessageQueue
{
private:
More information about the Libreoffice-commits
mailing list