Files
ladybird/Libraries/LibWeb/IndexedDB/IDBRecord.cpp
Shannon Booth fd44da6829 LibWeb/Bindings: Emit one bindings header and cpp per IDL
Previously, the LibWeb bindings generator would output multiple per
interface files like Prototype/Constructor/Namespace/GlobalMixin
depending on the contents of that IDL file.

This complicates the build system as it means that it does not know
what files will be generated without knowledge of the contents of that
IDL file.

Instead, for each IDL file only generate a single Bindings/<IDLFile>.h
and Bindings/<IDLFile>.cpp.
2026-04-21 07:36:13 +02:00

59 lines
1.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* Copyright (c) 2025, stelar7 <dudedbz@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/IDBRecord.h>
#include <LibWeb/IndexedDB/IDBRecord.h>
#include <LibWeb/IndexedDB/Internal/Algorithms.h>
namespace Web::IndexedDB {
GC_DEFINE_ALLOCATOR(IDBRecord);
IDBRecord::~IDBRecord() = default;
GC::Ref<IDBRecord> IDBRecord::create(JS::Realm& realm, GC::Ref<Key> key, JS::Value value, GC::Ref<Key> primary_key)
{
return realm.create<IDBRecord>(realm, move(key), move(value), move(primary_key));
}
IDBRecord::IDBRecord(JS::Realm& realm, GC::Ref<Key> key, JS::Value value, GC::Ref<Key> primary_key)
: PlatformObject(realm)
, m_key(move(key))
, m_value(move(value))
, m_primary_key(move(primary_key))
{
}
void IDBRecord::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBRecord);
Base::initialize(realm);
}
void IDBRecord::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_key);
visitor.visit(m_value);
visitor.visit(m_primary_key);
}
// https://pr-preview.s3.amazonaws.com/w3c/IndexedDB/pull/461.html#dom-idbrecord-key
WebIDL::ExceptionOr<JS::Value> IDBRecord::key() const
{
// The key getter steps are to return the result of converting a key to a value with thiss key.
return convert_a_key_to_a_value(realm(), m_key);
}
// https://pr-preview.s3.amazonaws.com/w3c/IndexedDB/pull/461.html#dom-idbrecord-primarykey
WebIDL::ExceptionOr<JS::Value> IDBRecord::primary_key() const
{
// The primaryKey getter steps are to return the result of converting a key to a value with thiss primary key.
return convert_a_key_to_a_value(realm(), m_primary_key);
}
}