Ladybird: Stop using the Qt event loop in WebContent and WebWorker

After the last 2 commits there is no need to keep using the Qt event
loop.

Upstream ladybird also stopped using the Qt event loop in 62c5f4b822d.
This commit is contained in:
Sönke Holz committed 2025-08-10 17:38:01 +02:00
1 parent 0b09b7535d
commit 53aefbda84
6 files changed
+31 -99

No files matched your search

+25 -38
View File
@@ -14,45 +14,32 @@ set(WEBCONTENT_SOURCES
../Utilities.cpp
)
if (ENABLE_QT)
qt_add_executable(WebContent ${WEBCONTENT_SOURCES})
target_sources(WebContent PRIVATE
../Qt/EventLoopImplementationQt.cpp
../Qt/EventLoopImplementationQtEventTarget.cpp
../Qt/StringUtils.cpp
main.cpp
)
target_link_libraries(WebContent PRIVATE Qt::Core)
target_compile_definitions(WebContent PRIVATE HAVE_QT=1)
set_target_properties(WebContent PROPERTIES AUTOMOC ON)
else()
set(LIB_TYPE STATIC)
if (IOS)
set(LIB_TYPE SHARED)
endif()
add_library(webcontent ${LIB_TYPE} ${WEBCONTENT_SOURCES})
target_include_directories(webcontent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
target_include_directories(webcontent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
target_include_directories(webcontent PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
target_link_libraries(webcontent PRIVATE LibAudio LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket LibProtocol LibWebView LibImageDecoderClient)
target_sources(webcontent PUBLIC FILE_SET ladybird TYPE HEADERS
BASE_DIRS ${SERENITY_SOURCE_DIR}
FILES ../FontPlugin.h
../ImageCodecPlugin.h
)
target_sources(webcontent PUBLIC FILE_SET server TYPE HEADERS
BASE_DIRS ${SERENITY_SOURCE_DIR}/Userland/Services
FILES ${WEBCONTENT_SOURCE_DIR}/ConnectionFromClient.h
${WEBCONTENT_SOURCE_DIR}/ConsoleGlobalEnvironmentExtensions.h
${WEBCONTENT_SOURCE_DIR}/Forward.h
${WEBCONTENT_SOURCE_DIR}/PageHost.h
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.h
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.h
)
add_executable(WebContent main.cpp)
target_link_libraries(WebContent PRIVATE webcontent)
set(LIB_TYPE STATIC)
if (IOS)
set(LIB_TYPE SHARED)
endif()
add_library(webcontent ${LIB_TYPE} ${WEBCONTENT_SOURCES})
target_include_directories(webcontent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
target_include_directories(webcontent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
target_include_directories(webcontent PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
target_link_libraries(webcontent PRIVATE LibAudio LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket LibProtocol LibWebView LibImageDecoderClient)
target_sources(webcontent PUBLIC FILE_SET ladybird TYPE HEADERS
BASE_DIRS ${SERENITY_SOURCE_DIR}
FILES ../FontPlugin.h
../ImageCodecPlugin.h
)
target_sources(webcontent PUBLIC FILE_SET server TYPE HEADERS
BASE_DIRS ${SERENITY_SOURCE_DIR}/Userland/Services
FILES ${WEBCONTENT_SOURCE_DIR}/ConnectionFromClient.h
${WEBCONTENT_SOURCE_DIR}/ConsoleGlobalEnvironmentExtensions.h
${WEBCONTENT_SOURCE_DIR}/Forward.h
${WEBCONTENT_SOURCE_DIR}/PageHost.h
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.h
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.h
)
add_executable(WebContent main.cpp)
target_link_libraries(WebContent PRIVATE webcontent)
target_include_directories(WebContent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
target_include_directories(WebContent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
-10
View File
@@ -35,11 +35,6 @@
#include <WebContent/PageClient.h>
#include <WebContent/WebDriverConnection.h>
#if defined(HAVE_QT)
# include <Ladybird/Qt/EventLoopImplementationQt.h>
# include <QCoreApplication>
#endif
#if defined(AK_OS_MACOS)
# include <LibCore/Platform/ProcessStatisticsMach.h>
#endif
@@ -64,11 +59,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
AK::set_rich_debug_enabled(true);
#if defined(HAVE_QT)
QCoreApplication app(arguments.argc, arguments.argv);
Core::EventLoopManager::install(*new Ladybird::EventLoopManagerQt);
#endif
Core::EventLoop event_loop;
platform_init();
+1 -15
View File
@@ -15,21 +15,7 @@ target_include_directories(webworker PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
target_include_directories(webworker PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
target_link_libraries(webworker PUBLIC LibCore LibFileSystem LibGfx LibIPC LibJS LibProtocol LibWeb LibWebView LibLocale LibImageDecoderClient LibMain LibSQL LibURL)
if (ENABLE_QT)
qt_add_executable(WebWorker
../Qt/EventLoopImplementationQt.cpp
../Qt/EventLoopImplementationQtEventTarget.cpp
../Qt/StringUtils.cpp
main.cpp
)
target_link_libraries(WebWorker PRIVATE Qt::Core)
target_link_libraries(WebWorker PRIVATE webworker LibWebSocket)
target_compile_definitions(WebWorker PRIVATE HAVE_QT=1)
set_target_properties(WebWorker PROPERTIES AUTOMOC ON)
else()
add_executable(WebWorker main.cpp)
endif()
add_executable(WebWorker main.cpp)
target_include_directories(WebWorker PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
target_link_libraries(WebWorker PRIVATE webworker)
-9
View File
@@ -26,11 +26,6 @@
#include <LibWebView/WebSocketClientAdapter.h>
#include <WebWorker/ConnectionFromClient.h>
#if defined(HAVE_QT)
# include <Ladybird/Qt/EventLoopImplementationQt.h>
# include <QCoreApplication>
#endif
static ErrorOr<void> initialize_lagom_networking(int request_server_socket);
ErrorOr<int> serenity_main(Main::Arguments arguments)
@@ -45,10 +40,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(serenity_resource_root, "Absolute path to directory for serenity resources", "serenity-resource-root", 'r', "serenity-resource-root");
args_parser.parse(arguments);
#if defined(HAVE_QT)
QCoreApplication app(arguments.argc, arguments.argv);
Core::EventLoopManager::install(*new Ladybird::EventLoopManagerQt);
#endif
Core::EventLoop event_loop;
platform_init();
@@ -1,19 +1,5 @@
import("//Ladybird/enable_qt.gni")
import("//Ladybird/link_qt.gni")
import("//Ladybird/moc_qt_objects.gni")
import("//Meta/gn/build/libs/pulse/enable.gni")
moc_qt_objects("generate_moc") {
sources = [ "//Ladybird/Qt/EventLoopImplementationQtEventTarget.h" ]
}
link_qt("WebContent_qt") {
qt_components = [
"Core",
"Network",
]
}
executable("WebContent") {
configs += [ "//Ladybird:ladybird_config" ]
include_dirs = [
@@ -55,19 +41,6 @@ executable("WebContent") {
"main.cpp",
]
if (enable_qt) {
defines = [ "HAVE_QT" ]
configs += [ ":WebContent_qt" ]
sources += [
"//Ladybird/Qt/EventLoopImplementationQt.cpp",
"//Ladybird/Qt/EventLoopImplementationQtEventTarget.cpp",
"//Ladybird/Qt/StringUtils.cpp",
]
sources += get_target_outputs(":generate_moc")
deps += [ ":generate_moc" ]
}
if (current_os == "linux" || current_os == "mac") {
cflags_cc = [ "-DHAS_ACCELERATED_GRAPHICS" ]
deps += [ "//Userland/Libraries/LibAccelGfx" ]
+5
View File
@@ -310,6 +310,11 @@ serenity_cherry_picks.add('50dc1c3c19b82af797c79b5aa694b3ac7f0114bb')
# PR https://github.com/SerenityOS/serenity/pull/26114
serenity_cherry_picks.add('1b324f3ae11d4f5750d89183f97bb3b3b2b4f801')
# WebContent and WebWorker stopped linking to Qt in the last commit of
# https://github.com/LadybirdBrowser/ladybird/pull/5331 and in serenity's
# PR https://github.com/SerenityOS/serenity/pull/26114
serenity_cherry_picks.add('62c5f4b822d62d6be8905dafc84341370491cd1e')
# Define a list of pull request IDs that should never be merged
# and the reasons why they shouldn't be merged.
# We fairly likely don't want the PRs in here (but it isn't 100% set