mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibWeb: Initialize HTML::EventLoop with its type
This commit is contained in:
parent
aa4e18fca5
commit
5d8784318d
Notes:
sideshowbarker
2024-07-16 19:42:24 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/5d8784318d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/543
10 changed files with 12 additions and 11 deletions
|
@ -68,7 +68,7 @@ ErrorOr<int> service_main(int ipc_socket)
|
|||
Web::HTML::Window::set_internals_object_exposed(is_layout_test_mode);
|
||||
Web::Platform::FontPlugin::install(*new Ladybird::FontPlugin(is_layout_test_mode));
|
||||
|
||||
TRY(Web::Bindings::initialize_main_thread_vm());
|
||||
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Window));
|
||||
|
||||
auto maybe_content_filter_error = load_content_filters();
|
||||
if (maybe_content_filter_error.is_error())
|
||||
|
|
|
@ -161,7 +161,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
Web::Platform::FontPlugin::install(*new Ladybird::FontPlugin(is_layout_test_mode));
|
||||
|
||||
TRY(Web::Bindings::initialize_main_thread_vm());
|
||||
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Window));
|
||||
|
||||
if (log_all_js_exceptions) {
|
||||
JS::g_log_all_js_exceptions = true;
|
||||
|
|
|
@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
#endif
|
||||
TRY(initialize_lagom_networking(request_server_socket));
|
||||
|
||||
TRY(Web::Bindings::initialize_main_thread_vm());
|
||||
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Worker));
|
||||
|
||||
auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebWorker::ConnectionFromClient>());
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Globals {
|
|||
Globals::Globals()
|
||||
{
|
||||
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
||||
MUST(Web::Bindings::initialize_main_thread_vm());
|
||||
MUST(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Window));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ HTML::Script* active_script()
|
|||
});
|
||||
}
|
||||
|
||||
ErrorOr<void> initialize_main_thread_vm()
|
||||
ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
|
||||
{
|
||||
VERIFY(!s_main_thread_vm);
|
||||
|
||||
|
@ -90,7 +90,7 @@ ErrorOr<void> initialize_main_thread_vm()
|
|||
s_main_thread_vm->ref();
|
||||
|
||||
auto& custom_data = verify_cast<WebEngineCustomData>(*s_main_thread_vm->custom_data());
|
||||
custom_data.event_loop = s_main_thread_vm->heap().allocate_without_realm<HTML::EventLoop>();
|
||||
custom_data.event_loop = s_main_thread_vm->heap().allocate_without_realm<HTML::EventLoop>(type);
|
||||
|
||||
// These strings could potentially live on the VM similar to CommonPropertyNames.
|
||||
DOM::MutationType::initialize_strings();
|
||||
|
|
|
@ -80,7 +80,7 @@ struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData
|
|||
|
||||
HTML::Script* active_script();
|
||||
|
||||
ErrorOr<void> initialize_main_thread_vm();
|
||||
ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type);
|
||||
JS::VM& main_thread_vm();
|
||||
|
||||
void queue_mutation_observer_microtask(DOM::Document const&);
|
||||
|
|
|
@ -24,7 +24,8 @@ namespace Web::HTML {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(EventLoop);
|
||||
|
||||
EventLoop::EventLoop()
|
||||
EventLoop::EventLoop(Type type)
|
||||
: m_type(type)
|
||||
{
|
||||
m_task_queue = heap().allocate_without_realm<TaskQueue>(*this);
|
||||
m_microtask_queue = heap().allocate_without_realm<TaskQueue>(*this);
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
bool execution_paused() const { return m_execution_paused; }
|
||||
|
||||
private:
|
||||
EventLoop();
|
||||
explicit EventLoop(Type);
|
||||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
});
|
||||
|
||||
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));
|
||||
TRY(Web::Bindings::initialize_main_thread_vm());
|
||||
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Window));
|
||||
|
||||
auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ConnectionFromClient>());
|
||||
return event_loop.exec();
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
Web::Platform::FontPlugin::install(*new Web::Platform::FontPluginSerenity);
|
||||
|
||||
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));
|
||||
TRY(Web::Bindings::initialize_main_thread_vm());
|
||||
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Worker));
|
||||
|
||||
auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebWorker::ConnectionFromClient>());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue