/* * Copyright (c) 2024, Andrew Kaster * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::WebAssembly { struct GlobalDescriptor { Bindings::ValueType value; bool mutable_ { false }; }; class Global : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(Global, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(Global); public: static WebIDL::ExceptionOr> construct_impl(JS::Realm&, GlobalDescriptor& descriptor, JS::Value v); WebIDL::ExceptionOr value_of() const; WebIDL::ExceptionOr set_value(JS::Value); WebIDL::ExceptionOr value() const; Wasm::GlobalAddress address() const { return m_address; } private: Global(JS::Realm&, Wasm::GlobalAddress); virtual void initialize(JS::Realm&) override; Wasm::GlobalAddress m_address; }; }