1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

LibWeb: Make Fetch::Infrastructure::{Request,Response,HeaderList} GC'd

This is the way.

On a more serious note, there's no reason to keep adding ref-counted
classes to LibWeb now that the majority of classes is GC'd - it only
adds the risk of discovering some cycle down the line, and forces us to
use handles as we can't visit().
This commit is contained in:
Linus Groh 2022-10-30 01:52:07 +00:00
parent 63122d0276
commit b1968b8bed
19 changed files with 270 additions and 169 deletions

View file

@ -64,7 +64,7 @@ class Request final
WEB_PLATFORM_OBJECT(Request, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<Request> create(NonnullRefPtr<Infrastructure::Request>, Headers::Guard, JS::Realm&);
[[nodiscard]] static JS::NonnullGCPtr<Request> create(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Request>, Headers::Guard);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> construct_impl(JS::Realm&, RequestInfo const& input, RequestInit const& init = {});
virtual ~Request() override;
@ -74,7 +74,7 @@ public:
virtual Optional<Infrastructure::Body&> body_impl() override;
virtual Optional<Infrastructure::Body const&> body_impl() const override;
[[nodiscard]] NonnullRefPtr<Infrastructure::Request> request() const { return m_request; }
[[nodiscard]] JS::NonnullGCPtr<Infrastructure::Request> request() const { return m_request; }
// JS API functions
[[nodiscard]] String method() const;
@ -96,13 +96,13 @@ public:
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> clone() const;
private:
Request(JS::Realm&, NonnullRefPtr<Infrastructure::Request>);
Request(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Request>);
virtual void visit_edges(Cell::Visitor&) override;
// https://fetch.spec.whatwg.org/#concept-request-request
// A Request object has an associated request (a request).
NonnullRefPtr<Infrastructure::Request> m_request;
JS::NonnullGCPtr<Infrastructure::Request> m_request;
// https://fetch.spec.whatwg.org/#request-headers
// A Request object also has an associated headers (null or a Headers object), initially null.