mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird: Don't burn 100% CPU in EventLoopPluginQt::spin_until()
There's no point in busy-waiting for the condition to come true. By passing the `WaitForMoreEvents` flag to `processEvents()`, we allow Qt to block until it has something for us to react to. This was extremely noticeable when waiting for large resources to finish loading.
This commit is contained in:
parent
bc6a6190d8
commit
ef553a4b76
Notes:
sideshowbarker
2024-07-17 02:40:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ef553a4b76 Pull-request: https://github.com/SerenityOS/serenity/pull/16583 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ EventLoopPluginQt::~EventLoopPluginQt() = default;
|
|||
void EventLoopPluginQt::spin_until(Function<bool()> goal_condition)
|
||||
{
|
||||
while (!goal_condition())
|
||||
QCoreApplication::processEvents();
|
||||
QCoreApplication::processEvents(QEventLoop::ProcessEventsFlag::AllEvents | QEventLoop::ProcessEventsFlag::WaitForMoreEvents);
|
||||
}
|
||||
|
||||
void EventLoopPluginQt::deferred_invoke(Function<void()> function)
|
||||
|
|
Loading…
Reference in a new issue