/src/serenity/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include "EventLoopPluginSerenity.h" |
8 | | #include <AK/NonnullRefPtr.h> |
9 | | #include <LibCore/EventLoop.h> |
10 | | #include <LibWeb/Platform/TimerSerenity.h> |
11 | | |
12 | | namespace Web::Platform { |
13 | | |
14 | 0 | EventLoopPluginSerenity::EventLoopPluginSerenity() = default; |
15 | 0 | EventLoopPluginSerenity::~EventLoopPluginSerenity() = default; |
16 | | |
17 | | void EventLoopPluginSerenity::spin_until(JS::SafeFunction<bool()> goal_condition) |
18 | 0 | { |
19 | 0 | Core::EventLoop::current().spin_until(move(goal_condition)); |
20 | 0 | } |
21 | | |
22 | | void EventLoopPluginSerenity::deferred_invoke(JS::SafeFunction<void()> function) |
23 | 0 | { |
24 | 0 | VERIFY(function); |
25 | 0 | Core::deferred_invoke(move(function)); |
26 | 0 | } |
27 | | |
28 | | NonnullRefPtr<Timer> EventLoopPluginSerenity::create_timer() |
29 | 0 | { |
30 | 0 | return TimerSerenity::create(); |
31 | 0 | } |
32 | | |
33 | | void EventLoopPluginSerenity::quit() |
34 | 0 | { |
35 | 0 | Core::EventLoop::current().quit(0); |
36 | 0 | } |
37 | | |
38 | | } |