LibWeb: Use HeapFunction directly in SessionHistoryTraversalQueue

This allows us to use HeapFunction all of the way down, allowing us
to remove the Handle usage in after_session_callback for
create_new_child_navigable.
This commit is contained in:
Shannon Booth 2024-08-18 17:45:56 +12:00 committed by Andreas Kling
parent b6d2ab2332
commit fc83653f3c
Notes: github-actions[bot] 2024-08-18 09:16:10 +00:00
8 changed files with 33 additions and 33 deletions

View file

@ -12,9 +12,9 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(SessionHistoryTraversalQueue);
JS_DEFINE_ALLOCATOR(SessionHistoryTraversalQueueEntry);
JS::NonnullGCPtr<SessionHistoryTraversalQueueEntry> SessionHistoryTraversalQueueEntry::create(JS::VM& vm, Function<void()> steps, JS::GCPtr<HTML::Navigable> target_navigable)
JS::NonnullGCPtr<SessionHistoryTraversalQueueEntry> SessionHistoryTraversalQueueEntry::create(JS::VM& vm, JS::NonnullGCPtr<JS::HeapFunction<void()>> steps, JS::GCPtr<HTML::Navigable> target_navigable)
{
return vm.heap().allocate_without_realm<SessionHistoryTraversalQueueEntry>(JS::create_heap_function(vm.heap(), move(steps)), target_navigable);
return vm.heap().allocate_without_realm<SessionHistoryTraversalQueueEntry>(steps, target_navigable);
}
void SessionHistoryTraversalQueueEntry::visit_edges(JS::Cell::Visitor& visitor)
@ -46,17 +46,17 @@ void SessionHistoryTraversalQueue::visit_edges(JS::Cell::Visitor& visitor)
visitor.visit(m_queue);
}
void SessionHistoryTraversalQueue::append(Function<void()> steps)
void SessionHistoryTraversalQueue::append(JS::NonnullGCPtr<JS::HeapFunction<void()>> steps)
{
m_queue.append(SessionHistoryTraversalQueueEntry::create(vm(), move(steps), nullptr));
m_queue.append(SessionHistoryTraversalQueueEntry::create(vm(), steps, nullptr));
if (!m_timer->is_active()) {
m_timer->start();
}
}
void SessionHistoryTraversalQueue::append_sync(Function<void()> steps, JS::GCPtr<Navigable> target_navigable)
void SessionHistoryTraversalQueue::append_sync(JS::NonnullGCPtr<JS::HeapFunction<void()>> steps, JS::GCPtr<Navigable> target_navigable)
{
m_queue.append(SessionHistoryTraversalQueueEntry::create(vm(), move(steps), target_navigable));
m_queue.append(SessionHistoryTraversalQueueEntry::create(vm(), steps, target_navigable));
if (!m_timer->is_active()) {
m_timer->start();
}