mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibJS+LibWeb: Spin event loop via VM::CustomData abstraction
Instead of calling Core::EventLoop directly, LibJS now has a virtual function on VM::CustomData for customizing this behavior. We use this in LibWeb to plumb the spin request through to the PlatformEventPlugin.
This commit is contained in:
parent
9567e211e7
commit
7b0dd98103
4 changed files with 15 additions and 2 deletions
|
@ -97,8 +97,11 @@ ThrowCompletionOr<Value> await(VM& vm, Value value)
|
|||
// by letting the event loop spin until our promise is no longer pending, and then synchronously
|
||||
// running all queued promise jobs.
|
||||
// Note: This is not used by LibJS itself, and is performed for the embedder (i.e. LibWeb).
|
||||
if (Core::EventLoop::has_been_instantiated())
|
||||
Core::EventLoop::current().spin_until([&] { return success.has_value(); });
|
||||
if (auto* custom_data = vm.custom_data()) {
|
||||
custom_data->spin_event_loop_until([&] {
|
||||
return success.has_value();
|
||||
});
|
||||
}
|
||||
|
||||
// 8. Remove asyncContext from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context.
|
||||
// NOTE: Since we don't push any EC, this step is not performed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue