Coverage Report

Created: 2025-11-16 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp
Line
Count
Source
1
/*
2
 * Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
3
 * Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#include <LibWeb/Bindings/ByteLengthQueuingStrategyPrototype.h>
9
#include <LibWeb/Bindings/Intrinsics.h>
10
#include <LibWeb/HTML/Window.h>
11
#include <LibWeb/Streams/ByteLengthQueuingStrategy.h>
12
13
namespace Web::Streams {
14
15
JS_DEFINE_ALLOCATOR(ByteLengthQueuingStrategy);
16
17
// https://streams.spec.whatwg.org/#blqs-constructor
18
JS::NonnullGCPtr<ByteLengthQueuingStrategy> ByteLengthQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init)
19
0
{
20
    // The new ByteLengthQueuingStrategy(init) constructor steps are:
21
    // 1. Set this.[[highWaterMark]] to init["highWaterMark"].
22
0
    return realm.heap().allocate<ByteLengthQueuingStrategy>(realm, realm, init.high_water_mark);
23
0
}
24
25
ByteLengthQueuingStrategy::ByteLengthQueuingStrategy(JS::Realm& realm, double high_water_mark)
26
0
    : PlatformObject(realm)
27
0
    , m_high_water_mark(high_water_mark)
28
0
{
29
0
}
30
31
0
ByteLengthQueuingStrategy::~ByteLengthQueuingStrategy() = default;
32
33
// https://streams.spec.whatwg.org/#blqs-size
34
JS::NonnullGCPtr<WebIDL::CallbackType> ByteLengthQueuingStrategy::size()
35
0
{
36
    // 1. Return this's relevant global object's byte length queuing strategy size function.
37
0
    return verify_cast<HTML::Window>(HTML::relevant_global_object(*this)).byte_length_queuing_strategy_size_function();
38
0
}
39
40
void ByteLengthQueuingStrategy::initialize(JS::Realm& realm)
41
0
{
42
0
    Base::initialize(realm);
43
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(ByteLengthQueuingStrategy);
44
0
}
45
46
}