mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWebView+UI: Don't declare a magic ctor for Application subclasses
You would have to just know that you need to define the constructor with this declaration. Let's allow subclasses to define constructors as they see fit.
This commit is contained in:
parent
3a4f2faf2e
commit
b425ce93b1
Notes:
github-actions[bot]
2025-06-11 11:27:40 +00:00
Author: https://github.com/trflynn89
Commit: b425ce93b1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5054
7 changed files with 24 additions and 33 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Optional.h>
|
||||
|
@ -71,17 +70,10 @@ public:
|
|||
void refresh_tab_list();
|
||||
|
||||
protected:
|
||||
template<DerivedFrom<Application> ApplicationType>
|
||||
static NonnullOwnPtr<ApplicationType> create(Main::Arguments const& arguments)
|
||||
{
|
||||
auto app = adopt_own(*new ApplicationType { {} });
|
||||
app->initialize(arguments);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
Application();
|
||||
|
||||
void initialize(Main::Arguments const&);
|
||||
|
||||
virtual void process_did_exit(Process&&);
|
||||
|
||||
virtual void create_platform_arguments(Core::ArgsParser&) { }
|
||||
|
@ -93,8 +85,6 @@ protected:
|
|||
Main::Arguments& arguments() { return m_arguments; }
|
||||
|
||||
private:
|
||||
void initialize(Main::Arguments const& arguments);
|
||||
|
||||
void launch_spare_web_content_process();
|
||||
ErrorOr<void> launch_request_server();
|
||||
ErrorOr<void> launch_image_decoder_server();
|
||||
|
@ -160,16 +150,17 @@ private:
|
|||
|
||||
}
|
||||
|
||||
#define WEB_VIEW_APPLICATION(ApplicationType) \
|
||||
public: \
|
||||
static NonnullOwnPtr<ApplicationType> create(Main::Arguments const& arguments) \
|
||||
{ \
|
||||
return WebView::Application::create<ApplicationType>(arguments); \
|
||||
} \
|
||||
\
|
||||
static ApplicationType& the() \
|
||||
{ \
|
||||
return static_cast<ApplicationType&>(WebView::Application::the()); \
|
||||
} \
|
||||
\
|
||||
ApplicationType(Badge<WebView::Application>);
|
||||
#define WEB_VIEW_APPLICATION(ApplicationType) \
|
||||
public: \
|
||||
template<typename... ApplicationArguments> \
|
||||
static NonnullOwnPtr<ApplicationType> create(Main::Arguments const& arguments, ApplicationArguments&&... application_arguments) \
|
||||
{ \
|
||||
auto app = adopt_own(*new ApplicationType { forward<ApplicationArguments>(application_arguments)... }); \
|
||||
app->initialize(arguments); \
|
||||
return app; \
|
||||
} \
|
||||
\
|
||||
static ApplicationType& the() \
|
||||
{ \
|
||||
return static_cast<ApplicationType&>(WebView::Application::the()); \
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue