mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 06:59:47 +00:00
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
|
|
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/CountQueuingStrategyPrototype.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/HTML/UniversalGlobalScope.h>
|
|
#include <LibWeb/Streams/CountQueuingStrategy.h>
|
|
|
|
namespace Web::Streams {
|
|
|
|
GC_DEFINE_ALLOCATOR(CountQueuingStrategy);
|
|
|
|
// https://streams.spec.whatwg.org/#blqs-constructor
|
|
GC::Ref<CountQueuingStrategy> CountQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init)
|
|
{
|
|
// The new CountQueuingStrategy(init) constructor steps are:
|
|
// 1. Set this.[[highWaterMark]] to init["highWaterMark"].
|
|
return realm.create<CountQueuingStrategy>(realm, init.high_water_mark);
|
|
}
|
|
|
|
CountQueuingStrategy::CountQueuingStrategy(JS::Realm& realm, double high_water_mark)
|
|
: PlatformObject(realm)
|
|
, m_high_water_mark(high_water_mark)
|
|
{
|
|
}
|
|
|
|
CountQueuingStrategy::~CountQueuingStrategy() = default;
|
|
|
|
// https://streams.spec.whatwg.org/#cqs-size
|
|
GC::Ref<WebIDL::CallbackType> CountQueuingStrategy::size()
|
|
{
|
|
// 1. Return this's relevant global object's count queuing strategy size function.
|
|
auto& global = as<HTML::UniversalGlobalScopeMixin>(HTML::relevant_global_object(*this));
|
|
return global.count_queuing_strategy_size_function();
|
|
}
|
|
|
|
void CountQueuingStrategy::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(CountQueuingStrategy);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
}
|