Internals.cpp 712 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Runtime/VM.h>
  7. #include <LibWeb/Bindings/InternalsPrototype.h>
  8. #include <LibWeb/Bindings/Intrinsics.h>
  9. #include <LibWeb/Internals/Internals.h>
  10. namespace Web::Internals {
  11. Internals::Internals(JS::Realm& realm)
  12. : Bindings::PlatformObject(realm)
  13. {
  14. }
  15. Internals::~Internals() = default;
  16. JS::ThrowCompletionOr<void> Internals::initialize(JS::Realm& realm)
  17. {
  18. TRY(Base::initialize(realm));
  19. Object::set_prototype(&Bindings::ensure_web_prototype<Bindings::InternalsPrototype>(realm, "Internals"));
  20. return {};
  21. }
  22. void Internals::gc()
  23. {
  24. vm().heap().collect_garbage();
  25. }
  26. }