1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:07:46 +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:
Andreas Kling 2022-09-08 00:13:39 +02:00
parent 9567e211e7
commit 7b0dd98103
4 changed files with 15 additions and 2 deletions

View file

@ -21,6 +21,7 @@
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Platform/EventLoopPlugin.h>
namespace Web::Bindings {
@ -413,4 +414,9 @@ NonnullOwnPtr<JS::ExecutionContext> create_a_new_javascript_realm(JS::VM& vm, Fu
return realm_execution_context;
}
void WebEngineCustomData::spin_event_loop_until(Function<bool()> goal_condition)
{
Platform::EventLoopPlugin::the().spin_until(move(goal_condition));
}
}