| 
									
										
										
										
											2023-06-18 19:43:56 +12:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2023-07-15 22:33:22 +12:00
										 |  |  |  * Copyright (c) 2023, Shannon Booth <shannon@serenityos.org> | 
					
						
							| 
									
										
										
										
											2023-06-18 19:43:56 +12:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Forward.h>
 | 
					
						
							|  |  |  | #include <LibJS/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Bindings/PlatformObject.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Streams/QueuingStrategyInit.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Streams { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://streams.spec.whatwg.org/#countqueuingstrategy
 | 
					
						
							|  |  |  | class CountQueuingStrategy final : public Bindings::PlatformObject { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(CountQueuingStrategy, Bindings::PlatformObject); | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_DECLARE_ALLOCATOR(CountQueuingStrategy); | 
					
						
							| 
									
										
										
										
											2023-06-18 19:43:56 +12:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     static GC::Ref<CountQueuingStrategy> construct_impl(JS::Realm&, QueuingStrategyInit const&); | 
					
						
							| 
									
										
										
										
											2023-06-18 19:43:56 +12:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual ~CountQueuingStrategy() override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://streams.spec.whatwg.org/#cqs-high-water-mark
 | 
					
						
							|  |  |  |     double high_water_mark() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // The highWaterMark getter steps are:
 | 
					
						
							|  |  |  |         // 1. Return this.[[highWaterMark]].
 | 
					
						
							|  |  |  |         return m_high_water_mark; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ref<WebIDL::CallbackType> size(); | 
					
						
							| 
									
										
										
										
											2023-06-23 08:46:46 +12:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-18 19:43:56 +12:00
										 |  |  | private: | 
					
						
							|  |  |  |     explicit CountQueuingStrategy(JS::Realm&, double high_water_mark); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2023-06-18 19:43:56 +12:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // https://streams.spec.whatwg.org/#countqueuingstrategy-highwatermark
 | 
					
						
							|  |  |  |     double m_high_water_mark { 0 }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |