LibWeb: Add a mechanism to opt out of generating instance wrappers

To enable incremental movement towards the removal of DOM object
instance wrappers, this patch adds a NO_INSTANCE argument that can be
passed to libweb_js_wrapper().
This commit is contained in:
Andreas Kling 2022-08-06 14:51:11 +02:00
parent 91ed6125fd
commit b33b426b2e
Notes: sideshowbarker 2024-07-17 07:29:27 +09:00

View file

@ -106,23 +106,34 @@ function (generate_js_wrappers target)
function(libweb_js_wrapper class)
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_WRAPPER "ITERABLE" "" "")
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_WRAPPER "NO_INSTANCE" "" "")
get_filename_component(basename "${class}" NAME)
set(BINDINGS_SOURCES
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Wrapper.h"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Wrapper.cpp"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.h"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.cpp"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Prototype.h"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Prototype.cpp"
)
set(BINDINGS_TYPES
header
implementation
constructor-header
constructor-implementation
prototype-header
prototype-implementation
)
if(NOT LIBWEB_WRAPPER_NO_INSTANCE)
set(BINDINGS_SOURCES
${BINDINGS_SOURCES}
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Wrapper.h"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Wrapper.cpp"
)
set(BINDINGS_TYPES
${BINDINGS_TYPES}
header
implementation
)
endif()
# FIXME: Instead of requiring a manual declaration of iterable wrappers, we should ask WrapperGenerator if it's iterable
if(LIBWEB_WRAPPER_ITERABLE)
list(APPEND BINDINGS_SOURCES