mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-18 17:12:54 +00:00
LibWeb: Port EventLoop::spin_XXX to HeapFunction
This commit is contained in:
parent
29cea5bd24
commit
1c18b900e2
Notes:
github-actions[bot]
2024-10-30 19:57:02 +00:00
Author: https://github.com/shannonbooth
Commit: 1c18b900e2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2062
Reviewed-by: https://github.com/kalenikaliaksandr ✅
14 changed files with 68 additions and 65 deletions
|
@ -298,9 +298,9 @@ void EventSource::reestablish_the_connection()
|
|||
}));
|
||||
|
||||
// 2. Wait a delay equal to the reconnection time of the event source.
|
||||
HTML::main_thread_event_loop().spin_until([&, delay_start = MonotonicTime::now()]() {
|
||||
HTML::main_thread_event_loop().spin_until(JS::create_heap_function(heap(), [&, delay_start = MonotonicTime::now()]() {
|
||||
return (MonotonicTime::now() - delay_start) >= m_reconnection_time;
|
||||
});
|
||||
}));
|
||||
|
||||
// 3. Optionally, wait some more. In particular, if the previous attempt failed, then user agents might introduce
|
||||
// an exponential backoff delay to avoid overloading a potentially already overloaded server. Alternatively, if
|
||||
|
@ -309,7 +309,7 @@ void EventSource::reestablish_the_connection()
|
|||
|
||||
// 4. Wait until the aforementioned task has run, if it has not yet run.
|
||||
if (!initial_task_has_run) {
|
||||
HTML::main_thread_event_loop().spin_until([&]() { return initial_task_has_run; });
|
||||
HTML::main_thread_event_loop().spin_until(JS::create_heap_function(heap(), [&]() { return initial_task_has_run; }));
|
||||
}
|
||||
|
||||
// 5. Queue a task to run the following steps:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue