mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibJS+LibWeb: Defer initialization of the Agent after VM constructor
This helps unwind a niggly depedency where the VM owns and constructs the Heap and the Agent. But the agent wants to have customized construction that depends on the heap. Solve this by defering the initialization of the Agent to after we have constructed the VM and the heap.
This commit is contained in:
parent
8263a9863f
commit
7dd7e5b438
Notes:
github-actions[bot]
2025-04-25 14:45:40 +00:00
Author: https://github.com/shannonbooth
Commit: 7dd7e5b438
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4453
3 changed files with 8 additions and 7 deletions
|
@ -76,7 +76,8 @@ void initialize_main_thread_vm(HTML::EventLoop::Type type)
|
|||
{
|
||||
VERIFY(!s_main_thread_vm);
|
||||
|
||||
s_main_thread_vm = JS::VM::create(make<HTML::SimilarOriginWindowAgent>());
|
||||
s_main_thread_vm = JS::VM::create();
|
||||
s_main_thread_vm->set_agent(make<HTML::SimilarOriginWindowAgent>());
|
||||
|
||||
auto& agent = as<HTML::Agent>(*s_main_thread_vm->agent());
|
||||
agent.event_loop = s_main_thread_vm->heap().allocate<HTML::EventLoop>(type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue