mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Use HeapFunction for Platform::Timer
This commit is contained in:
parent
ede3c91688
commit
de1a805898
Notes:
github-actions[bot]
2024-10-30 19:57:21 +00:00
Author: https://github.com/shannonbooth
Commit: de1a805898
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2062
Reviewed-by: https://github.com/kalenikaliaksandr ✅
8 changed files with 28 additions and 18 deletions
|
@ -415,12 +415,12 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
|
|||
|
||||
if (timeout.has_value() && timeout.value() > 0) {
|
||||
auto timer = Platform::Timer::create_single_shot(m_heap, timeout.value(), nullptr);
|
||||
timer->on_timeout = [timer, protocol_request, timeout_callback = move(timeout_callback)] {
|
||||
timer->on_timeout = JS::create_heap_function(m_heap, [timer = JS::make_handle(timer), protocol_request, timeout_callback = move(timeout_callback)] {
|
||||
(void)timer;
|
||||
protocol_request->stop();
|
||||
if (timeout_callback)
|
||||
timeout_callback();
|
||||
};
|
||||
});
|
||||
timer->start();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue