mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 12:44:43 +00:00
There's no guarantee that a task will ever be run. A page can be shutdown by the user or timeout or an error. Scheduler cleanup relies on the underlying page.arena. This forces all tasks to rely on the page.arena as they have no way to clean themselves. This commit allows tasks to register a finalizer which is guaranteed to be called when the scheduler is shutdown. The window ScheduleCallback, PostMessageCallback now use an arena from the ArenaPool rather than the page.arena and use the task finalizer to ensure the arena is released on shutdown.