mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +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
|
@ -47,7 +47,7 @@ enum class EvalMode {
|
|||
|
||||
class VM : public RefCounted<VM> {
|
||||
public:
|
||||
static NonnullRefPtr<VM> create(OwnPtr<Agent> = {});
|
||||
static NonnullRefPtr<VM> create();
|
||||
~VM();
|
||||
|
||||
GC::Heap& heap() { return m_heap; }
|
||||
|
@ -240,6 +240,7 @@ public:
|
|||
Function<void(Promise&)> on_promise_rejection_handled;
|
||||
Function<void(Object const&, PropertyKey const&)> on_unimplemented_property_access;
|
||||
|
||||
void set_agent(OwnPtr<Agent> agent) { m_agent = move(agent); }
|
||||
Agent* agent() { return m_agent; }
|
||||
Agent const* agent() const { return m_agent; }
|
||||
|
||||
|
@ -290,7 +291,7 @@ private:
|
|||
#undef __JS_ENUMERATE
|
||||
};
|
||||
|
||||
VM(OwnPtr<Agent>, ErrorMessages);
|
||||
explicit VM(ErrorMessages);
|
||||
|
||||
void load_imported_module(ImportedModuleReferrer, ModuleRequest const&, GC::Ptr<GraphLoadingState::HostDefined>, ImportedModulePayload);
|
||||
ThrowCompletionOr<void> link_and_eval_module(CyclicModule&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue