2025-01-08 23:55:08 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
2025-09-09 20:41:59 +01:00
|
|
|
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
2025-01-08 23:55:08 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
|
#include <LibGC/Root.h>
|
|
|
|
|
#include <LibWeb/IndexedDB/IDBRequest.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::IndexedDB {
|
|
|
|
|
|
|
|
|
|
class RequestList : public AK::Vector<GC::Root<IDBRequest>> {
|
|
|
|
|
public:
|
2025-09-09 20:41:59 +01:00
|
|
|
void all_requests_processed(GC::Heap&, GC::Ref<GC::Function<void()>> on_complete);
|
|
|
|
|
void all_previous_requests_processed(GC::Heap&, GC::Ref<IDBRequest> const& request, GC::Ref<GC::Function<void()>> on_complete);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct PendingRequestProcess final : public GC::Cell {
|
|
|
|
|
GC_CELL(PendingRequestProcess, GC::Cell);
|
|
|
|
|
GC_DECLARE_ALLOCATOR(PendingRequestProcess);
|
|
|
|
|
|
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
|
|
|
|
|
void add_request_to_observe(GC::Ref<IDBRequest>);
|
|
|
|
|
|
|
|
|
|
Vector<GC::Ref<IDBRequestObserver>> requests_waiting_on;
|
|
|
|
|
GC::Ptr<GC::Function<void()>> after_all;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Vector<GC::Root<PendingRequestProcess>> m_pending_request_queue;
|
2025-01-08 23:55:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|