WorkerAgent.h 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefCounted.h>
  8. #include <LibWeb/Forward.h>
  9. #include <LibWeb/HTML/MessageEvent.h>
  10. #include <LibWeb/HTML/MessagePort.h>
  11. #include <LibWeb/HTML/Scripting/ClassicScript.h>
  12. #include <LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h>
  13. #include <LibWeb/HTML/Window.h>
  14. #include <LibWeb/Worker/WebWorkerClient.h>
  15. namespace Web::HTML {
  16. struct WorkerOptions {
  17. String type { "classic"_string };
  18. String credentials { "same-origin"_string };
  19. String name { String {} };
  20. };
  21. struct WorkerAgent : JS::Cell {
  22. JS_CELL(Agent, JS::Cell);
  23. WorkerAgent(AK::URL url, WorkerOptions const& options);
  24. RefPtr<Web::HTML::WebWorkerClient> m_worker_ipc;
  25. private:
  26. WorkerOptions m_worker_options;
  27. AK::URL m_url;
  28. // TODO: associate with MessagePorts?
  29. int m_message_port_fd;
  30. };
  31. }