diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-09 17:49:06 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-10 16:08:14 +0100 |
commit | 7bd8fd000f3f8e92ff632be2370a279ac2309250 (patch) | |
tree | 212c47b003f275c40bca964cb1fa4fbbe1824abc /Meta/CMake | |
parent | 59104262a4fe1b9a5aa234ea810842f205f305db (diff) | |
download | serenity-7bd8fd000f3f8e92ff632be2370a279ac2309250.zip |
LibWeb: Generate dedicated methods to create Web constructors/prototypes
Currently, for each exposed interface, we generate one massive function
to create every Web constructor and prototype. In an effort to lazily
create these instead, this first step is to extract the creation of each
of these into its own method.
First, this generates a forwarding header for all IDL types. This is to
allow callers to remain unchanged without forcing them to include the
(very heavy) generated IDL headers. This header is included by LibWeb's
forwarding header.
Next, this defines a base template method on Web::Bindings::Intrinsics
to create a prototype/constructor pair. Specializations of this template
are now generated in a new .cpp file, IntrinsicDefinitions.cpp. The base
Intrinsics class is updated to use this new method, and will continue to
cache the result.
Last, some WebAssembly classes are updated to use this new mechanism.
They were using some ad hoc cache keys that are now in line with the
generated specializations.
That one massive function is still used to invoke these specializations,
so they are not lazy as of this commit.
Diffstat (limited to 'Meta/CMake')
-rw-r--r-- | Meta/CMake/libweb_generators.cmake | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Meta/CMake/libweb_generators.cmake b/Meta/CMake/libweb_generators.cmake index 63ff5b2cc0..3b71144161 100644 --- a/Meta/CMake/libweb_generators.cmake +++ b/Meta/CMake/libweb_generators.cmake @@ -147,14 +147,18 @@ function (generate_js_bindings target) endfunction() function(generate_exposed_interface_files) - set(exposed_interface_sources DedicatedWorkerExposedInterfaces.cpp DedicatedWorkerExposedInterfaces.h - SharedWorkerExposedInterfaces.cpp SharedWorkerExposedInterfaces.h - WindowExposedInterfaces.cpp WindowExposedInterfaces.h) + set(exposed_interface_sources + Forward.h IntrinsicDefinitions.cpp + DedicatedWorkerExposedInterfaces.cpp DedicatedWorkerExposedInterfaces.h + SharedWorkerExposedInterfaces.cpp SharedWorkerExposedInterfaces.h + WindowExposedInterfaces.cpp WindowExposedInterfaces.h) list(TRANSFORM exposed_interface_sources PREPEND "Bindings/") add_custom_command( OUTPUT ${exposed_interface_sources} COMMAND "${CMAKE_COMMAND}" -E make_directory "tmp" COMMAND $<TARGET_FILE:Lagom::GenerateWindowOrWorkerInterfaces> -o "${CMAKE_CURRENT_BINARY_DIR}/tmp" -b "${LIBWEB_INPUT_FOLDER}" ${LIBWEB_ALL_IDL_FILES} + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/Forward.h "Bindings/Forward.h" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/IntrinsicDefinitions.cpp "Bindings/IntrinsicDefinitions.cpp" COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.h "Bindings/DedicatedWorkerExposedInterfaces.h" COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/DedicatedWorkerExposedInterfaces.cpp "Bindings/DedicatedWorkerExposedInterfaces.cpp" COMMAND "${CMAKE_COMMAND}" -E copy_if_different tmp/SharedWorkerExposedInterfaces.h "Bindings/SharedWorkerExposedInterfaces.h" |