ladybird/Libraries/LibWeb/IndexedDB/IDBObjectStore.h

41 lines
1.2 KiB
C
Raw Normal View History

2024-11-07 18:56:26 +01:00
/*
* Copyright (c) 2024-2025, stelar7 <dudedbz@gmail.com>
2024-11-07 18:56:26 +01:00
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGC/Heap.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/IndexedDB/IDBTransaction.h>
#include <LibWeb/IndexedDB/Internal/ObjectStore.h>
2024-11-07 18:56:26 +01:00
namespace Web::IndexedDB {
// https://w3c.github.io/IndexedDB/#object-store-interface
// https://w3c.github.io/IndexedDB/#object-store-handle-construct
2024-11-07 18:56:26 +01:00
class IDBObjectStore : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(IDBObjectStore, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(IDBObjectStore);
public:
virtual ~IDBObjectStore() override;
[[nodiscard]] static GC::Ref<IDBObjectStore> create(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
2024-11-07 18:56:26 +01:00
JS::Value key_path() const;
GC::Ref<IDBTransaction> transaction() const { return m_transaction; }
2024-11-07 18:56:26 +01:00
protected:
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
2024-11-07 18:56:26 +01:00
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor& visitor) override;
private:
// An object store handle has an associated object store and an associated transaction.
GC::Ref<ObjectStore> m_store;
GC::Ref<IDBTransaction> m_transaction;
2024-11-07 18:56:26 +01:00
};
}