mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-08 01:51:57 +00:00
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/HashMap.h>
|
|
#include <LibGC/Root.h>
|
|
#include <LibWeb/DOM/EventTarget.h>
|
|
#include <LibWeb/IndexedDB/IDBRequest.h>
|
|
#include <LibWeb/StorageAPI/StorageKey.h>
|
|
|
|
namespace Web::IndexedDB {
|
|
|
|
class ConnectionQueue : public AK::Vector<GC::Root<IDBRequest>> {
|
|
public:
|
|
bool all_previous_requests_processed(GC::Ref<IDBRequest> const& request) const
|
|
{
|
|
for (auto const& entry : *this) {
|
|
if (entry == request)
|
|
return true;
|
|
if (!entry->processed())
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
};
|
|
|
|
using ConnectionMap = HashMap<StorageAPI::StorageKey, HashMap<String, ConnectionQueue>>;
|
|
|
|
// https://w3c.github.io/IndexedDB/#connection-queues
|
|
class ConnectionQueueHandler {
|
|
public:
|
|
static ConnectionQueue& for_key_and_name(StorageAPI::StorageKey& key, String& name);
|
|
static ConnectionQueueHandler& the()
|
|
{
|
|
static ConnectionQueueHandler s_instance;
|
|
return s_instance;
|
|
}
|
|
|
|
private:
|
|
ConnectionMap m_open_requests;
|
|
};
|
|
|
|
}
|