summaryrefslogtreecommitdiff
path: root/Ladybird/WebContent
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-04-24 18:02:29 +0200
committerAndreas Kling <kling@serenityos.org>2023-04-25 14:48:40 +0200
commit1c6c3685c4c51000dd2397748db59177d2474688 (patch)
treeaad4fa184ab0fb5d4acfae9fc0d2f3a26363ab0d /Ladybird/WebContent
parent3494c2382d96e23c2791bf7e29bd90ef06de6fac (diff)
downloadserenity-1c6c3685c4c51000dd2397748db59177d2474688.zip
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.
Diffstat (limited to 'Ladybird/WebContent')
-rw-r--r--Ladybird/WebContent/CMakeLists.txt2
-rw-r--r--Ladybird/WebContent/main.cpp37
2 files changed, 3 insertions, 36 deletions
diff --git a/Ladybird/WebContent/CMakeLists.txt b/Ladybird/WebContent/CMakeLists.txt
index e553a105da..d8c9c1b780 100644
--- a/Ladybird/WebContent/CMakeLists.txt
+++ b/Ladybird/WebContent/CMakeLists.txt
@@ -7,11 +7,9 @@ set(WEBCONTENT_SOURCES
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.cpp
../EventLoopImplementationQt.cpp
- ../EventLoopPluginQt.cpp
../FontPluginQt.cpp
../ImageCodecPluginLadybird.cpp
../RequestManagerQt.cpp
- ../TimerQt.cpp
../Utilities.cpp
../WebSocketClientManagerLadybird.cpp
../WebSocketLadybird.cpp
diff --git a/Ladybird/WebContent/main.cpp b/Ladybird/WebContent/main.cpp
index 1b1f2fe2b5..72b8e7326c 100644
--- a/Ladybird/WebContent/main.cpp
+++ b/Ladybird/WebContent/main.cpp
@@ -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(&notifier, &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();
}