1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 14:55:07 +00:00

Ladybird: Use only the Qt event loop to speed everything up :^)

This patch removes the dual-event-loop setup, leaving only the Qt event
loop. We teach LibWeb how to drive Qt by installing an EventLoopPlugin.

This removes the 50ms latency on all UI interactions (and network
requests, etc.)
This commit is contained in:
Andreas Kling 2022-09-07 20:33:15 +02:00 committed by Andrew Kaster
parent dcab11f5e9
commit 37d844fd66
9 changed files with 209 additions and 28 deletions

View file

@ -8,7 +8,6 @@
#include "Settings.h"
#include "WebView.h"
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Timer.h>
#include <LibMain/Main.h>
#include <QApplication>
@ -29,22 +28,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
s_settings = new Browser::Settings();
Core::EventLoop event_loop;
QApplication app(arguments.argc, arguments.argv);
BrowserWindow window(event_loop);
BrowserWindow window;
window.setWindowTitle("Ladybird");
window.resize(800, 600);
window.show();
auto qt_event_loop_driver = Core::Timer::create_repeating(50, [&] {
app.processEvents();
});
qt_event_loop_driver->start();
if (!url.is_empty()) {
window.view().load(url);
}
return event_loop.exec();
return app.exec();
}