mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
Ladybird: Remove Web::Platform plugins for Qt in favor of LibCore
Now that the Core::EventLoop is driven by a QEventLoop in Ladybird, we don't need to patch LibWeb with Web::Platform plugins. This patch removes EventLoopPluginQt and TimerQt. Note that we can't just replace the Web::Platform abstractions with LibCore stuff immediately, since the Web::Platform APIs use JS::SafeFunction for callbacks.
This commit is contained in:
parent
3494c2382d
commit
1c6c3685c4
8 changed files with 4 additions and 258 deletions
|
@ -1,12 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020-2023, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
#include "../EventLoopImplementationQt.h"
|
||||
#include "../EventLoopPluginQt.h"
|
||||
#include "../FontPluginQt.h"
|
||||
#include "../ImageCodecPluginLadybird.h"
|
||||
#include "../RequestManagerQt.h"
|
||||
|
@ -25,9 +23,9 @@
|
|||
#include <LibWeb/Loader/FrameLoader.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
|
||||
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
||||
#include <LibWeb/WebSockets/WebSocket.h>
|
||||
#include <QGuiApplication>
|
||||
#include <QSocketNotifier>
|
||||
#include <QTimer>
|
||||
#include <WebContent/ConnectionFromClient.h>
|
||||
#include <WebContent/PageHost.h>
|
||||
|
@ -38,27 +36,6 @@ static ErrorOr<void> load_autoplay_allowlist();
|
|||
|
||||
extern DeprecatedString s_serenity_resource_root;
|
||||
|
||||
struct DeferredInvokerQt final : IPC::DeferredInvoker {
|
||||
virtual ~DeferredInvokerQt() = default;
|
||||
virtual void schedule(Function<void()> callback) override
|
||||
{
|
||||
QTimer::singleShot(0, move(callback));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ClientType>
|
||||
static void proxy_socket_through_notifier(ClientType& client, QSocketNotifier& notifier)
|
||||
{
|
||||
notifier.setSocket(client.socket().fd().value());
|
||||
notifier.setEnabled(true);
|
||||
|
||||
QObject::connect(¬ifier, &QSocketNotifier::activated, [&client]() mutable {
|
||||
client.socket().notifier()->on_activation();
|
||||
});
|
||||
|
||||
client.set_deferred_invoker(make<DeferredInvokerQt>());
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
QGuiApplication app(arguments.argc, arguments.argv);
|
||||
|
@ -68,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
platform_init();
|
||||
|
||||
Web::Platform::EventLoopPlugin::install(*new Ladybird::EventLoopPluginQt);
|
||||
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
||||
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPluginLadybird);
|
||||
|
||||
Web::ResourceLoader::initialize(RequestManagerQt::create());
|
||||
|
@ -102,14 +79,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto webcontent_client = TRY(WebContent::ConnectionFromClient::try_create(move(webcontent_socket)));
|
||||
webcontent_client->set_fd_passing_socket(TRY(Core::LocalSocket::adopt_fd(webcontent_fd_passing_socket)));
|
||||
|
||||
QSocketNotifier webcontent_notifier(QSocketNotifier::Type::Read);
|
||||
proxy_socket_through_notifier(*webcontent_client, webcontent_notifier);
|
||||
|
||||
QSocketNotifier webdriver_notifier(QSocketNotifier::Type::Read);
|
||||
webcontent_client->page_host().on_webdriver_connection = [&](auto& webdriver) {
|
||||
proxy_socket_through_notifier(webdriver, webdriver_notifier);
|
||||
};
|
||||
|
||||
return event_loop.exec();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue