
With this change, we now have ~1200 CellAllocators across both LibJS and LibWeb in a normal WebContent instance. This gives us a minimum heap size of 4.7 MiB in the scenario where we only have one cell allocated per type. Of course, in practice there will be many more of each type, so the effective overhead is quite a bit smaller than that in practice. I left a few types unconverted to this mechanism because I got tired of doing this. :^)
37 lines
980 B
C++
37 lines
980 B
C++
/*
|
|
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Heap/GCPtr.h>
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
#include <LibWeb/Fetch/Headers.h>
|
|
|
|
namespace Web::Fetch {
|
|
|
|
class HeadersIterator final : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(HeadersIterator, Bindings::PlatformObject);
|
|
JS_DECLARE_ALLOCATOR(HeadersIterator);
|
|
|
|
public:
|
|
[[nodiscard]] static JS::NonnullGCPtr<HeadersIterator> create(Headers const&, JS::Object::PropertyKind iteration_kind);
|
|
|
|
virtual ~HeadersIterator() override;
|
|
|
|
JS::ThrowCompletionOr<JS::Object*> next();
|
|
|
|
private:
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
|
|
|
HeadersIterator(Headers const&, JS::Object::PropertyKind iteration_kind);
|
|
|
|
JS::NonnullGCPtr<Headers const> m_headers;
|
|
JS::Object::PropertyKind m_iteration_kind;
|
|
size_t m_index { 0 };
|
|
};
|
|
|
|
}
|