MessageChannel.cpp 641 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/DOM/Document.h>
  7. #include <LibWeb/HTML/MessageChannel.h>
  8. #include <LibWeb/HTML/MessagePort.h>
  9. namespace Web::HTML {
  10. MessageChannel::MessageChannel()
  11. {
  12. // 1. Set this's port 1 to a new MessagePort in this's relevant Realm.
  13. m_port1 = MessagePort::create();
  14. // 2. Set this's port 2 to a new MessagePort in this's relevant Realm.
  15. m_port2 = MessagePort::create();
  16. // 3. Entangle this's port 1 and this's port 2.
  17. m_port1->entangle_with(*m_port2);
  18. }
  19. MessageChannel::~MessageChannel()
  20. {
  21. }
  22. }