Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KitQueue - re-spin poll loop when we have tiles to render. #10682

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions kit/Kit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2446,8 +2446,7 @@ void Document::drainQueue()
}
}

if (processInputEnabled() && !isLoadOngoing() &&
!isBackgroundSaveProcess() && _queue->getTileQueueSize() > 0)
if (canRenderTiles())
{
std::vector<TileCombined> tileRequests = _queue->popWholeTileQueue();

Expand Down
10 changes: 9 additions & 1 deletion kit/Kit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,22 @@ class Document final : public std::enable_shared_from_this<Document>
/// A new message from wsd for the queue
void queueMessage(const std::string &msg) { _queue->put(msg); }
bool hasQueueItems() const { return _queue && !_queue->isEmpty(); }
bool canRenderTiles() const {
return processInputEnabled() && !isLoadOngoing() &&
!isBackgroundSaveProcess() && _queue &&
_queue->getTileQueueSize() > 0;
}
bool hasCallbacks() const { return _queue && _queue->callbackSize() > 0; }

/// Should we get through the SocketPoll fast to process queus ?
bool needsQuickPoll() const
{
if (hasCallbacks())
return true;
if (hasQueueItems() && processInputEnabled())
// not processing input messages or tile renders
if (!processInputEnabled())
return false;
if (hasQueueItems() || canRenderTiles())
return true;
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions kit/KitQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ class KitQueue
int priority(const TileDesc &desc);

private:
/// The incoming underlying queue
/// Queue of incoming messages from coolwsd
std::vector<Payload> _queue;

/// Incoming tile request queue
/// Queue of incoming tile requests from coolwsd
std::vector<TileDesc> _tileQueue;

/// Outgoing queued callbacks
/// Queue of callbacks from Kit to send out to coolwsd
std::vector<Callback> _callbacks;

std::map<int, CursorPosition> _cursorPositions;
Expand Down
Loading