mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
52
Libraries/LibWeb/HTML/EventLoop/TaskQueue.h
Normal file
52
Libraries/LibWeb/HTML/EventLoop/TaskQueue.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2024, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Queue.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
class TaskQueue : public JS::Cell {
|
||||
JS_CELL(TaskQueue, JS::Cell);
|
||||
JS_DECLARE_ALLOCATOR(TaskQueue);
|
||||
|
||||
public:
|
||||
explicit TaskQueue(HTML::EventLoop&);
|
||||
virtual ~TaskQueue() override;
|
||||
|
||||
bool is_empty() const { return m_tasks.is_empty(); }
|
||||
|
||||
bool has_runnable_tasks() const;
|
||||
bool has_rendering_tasks() const;
|
||||
|
||||
void add(JS::NonnullGCPtr<HTML::Task>);
|
||||
JS::GCPtr<HTML::Task> take_first_runnable();
|
||||
|
||||
void enqueue(JS::NonnullGCPtr<HTML::Task> task) { add(task); }
|
||||
JS::GCPtr<HTML::Task> dequeue()
|
||||
{
|
||||
if (m_tasks.is_empty())
|
||||
return {};
|
||||
return m_tasks.take_first();
|
||||
}
|
||||
|
||||
void remove_tasks_matching(Function<bool(HTML::Task const&)>);
|
||||
JS::MarkedVector<JS::NonnullGCPtr<Task>> take_tasks_matching(Function<bool(HTML::Task const&)>);
|
||||
|
||||
Task const* last_added_task() const;
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
JS::NonnullGCPtr<HTML::EventLoop> m_event_loop;
|
||||
|
||||
Vector<JS::NonnullGCPtr<HTML::Task>> m_tasks;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue