LibWeb: Don't allocate a new HeapFunction 60 times per second

We can reuse the same HeapFunction when queueing up a rendering task
on the HTML event loop. No need to create extra work for the garbage
collector like this.
This commit is contained in:
Andreas Kling
2024-10-25 09:56:48 +02:00
committed by Andreas Kling
parent 1b127ac082
commit 5c6b879715
Notes: github-actions[bot] 2024-10-25 08:22:14 +00:00
2 changed files with 146 additions and 134 deletions

View File

@@ -81,6 +81,8 @@ private:
virtual void visit_edges(Visitor&) override;
void update_the_rendering();
Type m_type { Type::Window };
JS::GCPtr<TaskQueue> m_task_queue;
@@ -116,6 +118,8 @@ private:
bool m_skip_event_loop_processing_steps { false };
bool m_is_running_rendering_task { false };
JS::GCPtr<JS::HeapFunction<void()>> m_rendering_task_function;
};
EventLoop& main_thread_event_loop();