/src/serenity/Userland/Libraries/LibWeb/WebAssembly/Module.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org> |
3 | | * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org> |
4 | | * |
5 | | * SPDX-License-Identifier: BSD-2-Clause |
6 | | */ |
7 | | |
8 | | #pragma once |
9 | | |
10 | | #include <LibJS/Forward.h> |
11 | | #include <LibJS/Heap/GCPtr.h> |
12 | | #include <LibJS/Heap/Handle.h> |
13 | | #include <LibWasm/Types.h> |
14 | | #include <LibWeb/Bindings/ExceptionOrUtils.h> |
15 | | #include <LibWeb/Bindings/PlatformObject.h> |
16 | | #include <LibWeb/WebAssembly/WebAssembly.h> |
17 | | |
18 | | namespace Web::WebAssembly { |
19 | | |
20 | | class Module : public Bindings::PlatformObject { |
21 | | WEB_PLATFORM_OBJECT(Module, Bindings::PlatformObject); |
22 | | JS_DECLARE_ALLOCATOR(Module); |
23 | | |
24 | | public: |
25 | | static WebIDL::ExceptionOr<JS::NonnullGCPtr<Module>> construct_impl(JS::Realm&, JS::Handle<WebIDL::BufferSource>& bytes); |
26 | | |
27 | 0 | NonnullRefPtr<Detail::CompiledWebAssemblyModule> compiled_module() const { return m_compiled_module; } |
28 | | |
29 | | private: |
30 | | Module(JS::Realm&, NonnullRefPtr<Detail::CompiledWebAssemblyModule>); |
31 | | |
32 | | virtual void initialize(JS::Realm&) override; |
33 | | |
34 | | NonnullRefPtr<Detail::CompiledWebAssemblyModule> m_compiled_module; |
35 | | }; |
36 | | |
37 | | } |