| 
									
										
										
										
											2021-09-19 22:12:31 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibWeb/DOM/Document.h>
 | 
					
						
							|  |  |  | #include <LibWeb/HTML/MessageChannel.h>
 | 
					
						
							|  |  |  | #include <LibWeb/HTML/MessagePort.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-14 18:03:08 +01:00
										 |  |  | MessageChannel::MessageChannel() | 
					
						
							| 
									
										
										
										
											2021-09-19 22:12:31 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     // 1. Set this's port 1 to a new MessagePort in this's relevant Realm.
 | 
					
						
							| 
									
										
										
										
											2021-10-14 18:03:08 +01:00
										 |  |  |     m_port1 = MessagePort::create(); | 
					
						
							| 
									
										
										
										
											2021-09-19 22:12:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // 2. Set this's port 2 to a new MessagePort in this's relevant Realm.
 | 
					
						
							| 
									
										
										
										
											2021-10-14 18:03:08 +01:00
										 |  |  |     m_port2 = MessagePort::create(); | 
					
						
							| 
									
										
										
										
											2021-09-19 22:12:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // 3. Entangle this's port 1 and this's port 2.
 | 
					
						
							|  |  |  |     m_port1->entangle_with({}, *m_port2); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MessageChannel::~MessageChannel() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |