Module.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #pragma once
  8. #include <LibGC/Ptr.h>
  9. #include <LibGC/Root.h>
  10. #include <LibJS/Forward.h>
  11. #include <LibWasm/Types.h>
  12. #include <LibWeb/Bindings/ExceptionOrUtils.h>
  13. #include <LibWeb/Bindings/PlatformObject.h>
  14. #include <LibWeb/WebAssembly/WebAssembly.h>
  15. namespace Web::WebAssembly {
  16. class Module : public Bindings::PlatformObject {
  17. WEB_PLATFORM_OBJECT(Module, Bindings::PlatformObject);
  18. GC_DECLARE_ALLOCATOR(Module);
  19. public:
  20. static WebIDL::ExceptionOr<GC::Ref<Module>> construct_impl(JS::Realm&, GC::Root<WebIDL::BufferSource>& bytes);
  21. NonnullRefPtr<Detail::CompiledWebAssemblyModule> compiled_module() const { return m_compiled_module; }
  22. private:
  23. Module(JS::Realm&, NonnullRefPtr<Detail::CompiledWebAssemblyModule>);
  24. virtual void initialize(JS::Realm&) override;
  25. NonnullRefPtr<Detail::CompiledWebAssemblyModule> m_compiled_module;
  26. };
  27. }