/src/serenity/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Shannon Booth <shannon@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <AK/Forward.h> |
10 | | #include <LibJS/Forward.h> |
11 | | #include <LibWeb/Bindings/PlatformObject.h> |
12 | | #include <LibWeb/Forward.h> |
13 | | #include <LibWeb/Streams/QueuingStrategyInit.h> |
14 | | |
15 | | namespace Web::Streams { |
16 | | |
17 | | // https://streams.spec.whatwg.org/#countqueuingstrategy |
18 | | class CountQueuingStrategy final : public Bindings::PlatformObject { |
19 | | WEB_PLATFORM_OBJECT(CountQueuingStrategy, Bindings::PlatformObject); |
20 | | JS_DECLARE_ALLOCATOR(CountQueuingStrategy); |
21 | | |
22 | | public: |
23 | | static JS::NonnullGCPtr<CountQueuingStrategy> construct_impl(JS::Realm&, QueuingStrategyInit const&); |
24 | | |
25 | | virtual ~CountQueuingStrategy() override; |
26 | | |
27 | | // https://streams.spec.whatwg.org/#cqs-high-water-mark |
28 | | double high_water_mark() const |
29 | 0 | { |
30 | | // The highWaterMark getter steps are: |
31 | | // 1. Return this.[[highWaterMark]]. |
32 | 0 | return m_high_water_mark; |
33 | 0 | } |
34 | | |
35 | | JS::NonnullGCPtr<WebIDL::CallbackType> size(); |
36 | | |
37 | | private: |
38 | | explicit CountQueuingStrategy(JS::Realm&, double high_water_mark); |
39 | | |
40 | | virtual void initialize(JS::Realm&) override; |
41 | | |
42 | | // https://streams.spec.whatwg.org/#countqueuingstrategy-highwatermark |
43 | | double m_high_water_mark { 0 }; |
44 | | }; |
45 | | |
46 | | } |