mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Previously, the LibWeb bindings generator would output multiple per interface files like Prototype/Constructor/Namespace/GlobalMixin depending on the contents of that IDL file. This complicates the build system as it means that it does not know what files will be generated without knowledge of the contents of that IDL file. Instead, for each IDL file only generate a single Bindings/<IDLFile>.h and Bindings/<IDLFile>.cpp.
48 lines
1.5 KiB
C++
48 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/CountQueuingStrategy.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);
|
|
}
|
|
|
|
}
|