1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

LibWeb: Use cached_web_prototype() as much as possible

Unlike ensure_web_prototype<T>(), the cached version doesn't require the
prototype type to be fully formed, so we can use it without including
the FooPrototype.h header. It's also a bit less verbose. :^)
This commit is contained in:
Andreas Kling 2022-09-03 18:43:24 +02:00
parent a85542958c
commit ffad902c07
165 changed files with 176 additions and 325 deletions

View file

@ -2077,7 +2077,7 @@ namespace Web::Bindings {
if (interface.wrapper_base_class == "Wrapper") {
generator.append(R"~~~(
@wrapper_class@::@wrapper_class@(JS::Realm& realm, @fully_qualified_name@& impl)
: Wrapper(verify_cast<HTML::Window>(realm.global_object()).ensure_web_prototype<@prototype_class@>("@name@"))
: Wrapper(verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("@name@"))
, m_impl(impl)
{
}
@ -2087,7 +2087,7 @@ namespace Web::Bindings {
@wrapper_class@::@wrapper_class@(JS::Realm& realm, @fully_qualified_name@& impl)
: @wrapper_base_class@(realm, impl)
{
set_prototype(&verify_cast<HTML::Window>(realm.global_object()).ensure_web_prototype<@prototype_class@>("@name@"));
set_prototype(&verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("@name@"));
}
)~~~");
}
@ -3775,7 +3775,7 @@ namespace Web::Bindings {
}
@wrapper_class@::@wrapper_class@(JS::Realm& realm, @fully_qualified_name@& impl)
: Wrapper(verify_cast<HTML::Window>(realm.global_object()).ensure_web_prototype<@prototype_class@>("@name@"))
: Wrapper(verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("@name@"))
, m_impl(impl)
{
}