mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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.
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Optional.h>
|
|
#include <LibGC/Ptr.h>
|
|
#include <LibJS/Forward.h>
|
|
#include <LibJS/Runtime/Value.h>
|
|
#include <LibWasm/AbstractMachine/AbstractMachine.h>
|
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
#include <LibWeb/Bindings/Table.h>
|
|
|
|
namespace Web::WebAssembly {
|
|
|
|
struct TableDescriptor {
|
|
Bindings::TableKind element;
|
|
u32 initial { 0 };
|
|
Optional<u32> maximum;
|
|
};
|
|
|
|
class Table : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(Table, Bindings::PlatformObject);
|
|
GC_DECLARE_ALLOCATOR(Table);
|
|
|
|
public:
|
|
static WebIDL::ExceptionOr<GC::Ref<Table>> construct_impl(JS::Realm&, TableDescriptor& descriptor, JS::Value value);
|
|
|
|
WebIDL::ExceptionOr<u32> grow(u32 delta, JS::Value value);
|
|
|
|
WebIDL::ExceptionOr<JS::Value> get(u32 index) const;
|
|
WebIDL::ExceptionOr<void> set(u32 index, JS::Value value);
|
|
|
|
WebIDL::ExceptionOr<u32> length() const;
|
|
|
|
Wasm::TableAddress address() const { return m_address; }
|
|
|
|
private:
|
|
Table(JS::Realm&, Wasm::TableAddress);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
Wasm::TableAddress m_address;
|
|
};
|
|
|
|
}
|