MessageChannel.cpp 648 B

123456789101112131415161718192021222324252627
  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() = default;
  20. }