| 
									
										
										
										
											2022-09-07 20:30:31 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "EventLoopPluginSerenity.h"
 | 
					
						
							|  |  |  | #include <AK/Function.h>
 | 
					
						
							|  |  |  | #include <AK/NonnullRefPtr.h>
 | 
					
						
							|  |  |  | #include <LibCore/EventLoop.h>
 | 
					
						
							| 
									
										
										
										
											2022-09-21 19:33:57 +01:00
										 |  |  | #include <LibWeb/Platform/TimerSerenity.h>
 | 
					
						
							| 
									
										
										
										
											2022-09-07 20:30:31 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-21 19:33:57 +01:00
										 |  |  | namespace Web::Platform { | 
					
						
							| 
									
										
										
										
											2022-09-07 20:30:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | EventLoopPluginSerenity::EventLoopPluginSerenity() = default; | 
					
						
							|  |  |  | EventLoopPluginSerenity::~EventLoopPluginSerenity() = default; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void EventLoopPluginSerenity::spin_until(Function<bool()> goal_condition) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Core::EventLoop::current().spin_until(move(goal_condition)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void EventLoopPluginSerenity::deferred_invoke(Function<void()> function) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     VERIFY(function); | 
					
						
							|  |  |  |     Core::deferred_invoke(move(function)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-21 19:33:57 +01:00
										 |  |  | NonnullRefPtr<Timer> EventLoopPluginSerenity::create_timer() | 
					
						
							| 
									
										
										
										
											2022-09-07 20:30:31 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     return TimerSerenity::create(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |