Files
ladybird/Libraries/LibWeb/ServiceWorker/CacheStorage.h
Shannon Booth 5adfd1c43a LibWeb/Bindings: Generate struct definitions from IDL dictionaries
Previously we were inconsistent by generating code for enum definitions
but not generating code for dictionaries. With future changes to the
IDL generator to expose helpers to convert to and from IDL values
this produced circular depdendencies. To solve this problem, also
generate the dictionary definitions in bindings headers.
2026-05-09 10:49:49 +02:00

41 lines
1.2 KiB
C++

/*
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
* Copyright (c) 2026, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/ServiceWorker/Cache.h>
#include <LibWeb/ServiceWorker/NameToCacheMap.h>
#include <LibWeb/WebIDL/Promise.h>
namespace Web::ServiceWorker {
// https://w3c.github.io/ServiceWorker/#cachestorage-interface
class CacheStorage : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(CacheStorage, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(CacheStorage);
public:
GC::Ref<WebIDL::Promise> match(Fetch::RequestInfo, Bindings::MultiCacheQueryOptions);
GC::Ref<WebIDL::Promise> has(String const& cache_name);
GC::Ref<WebIDL::Promise> open(String const& cache_name);
GC::Ref<WebIDL::Promise> delete_(String const& cache_name);
GC::Ref<WebIDL::Promise> keys();
private:
explicit CacheStorage(JS::Realm&);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor&) override;
NameToCacheMap& relevant_name_to_cache_map();
NameToCacheMap m_relevant_name_to_cache_map;
};
}