mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 09:22:53 +00:00
LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
This commit is contained in:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
|
@ -7,8 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Bindings/RequestPrototype.h>
|
||||
#include <LibWeb/Fetch/Body.h>
|
||||
|
@ -31,41 +31,41 @@ class Response final
|
|||
: public Bindings::PlatformObject
|
||||
, public BodyMixin {
|
||||
WEB_PLATFORM_OBJECT(Response, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(Response);
|
||||
GC_DECLARE_ALLOCATOR(Response);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<Response> create(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Response>, Headers::Guard);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> construct_impl(JS::Realm&, Optional<BodyInit> const& body = {}, ResponseInit const& init = {});
|
||||
[[nodiscard]] static GC::Ref<Response> create(JS::Realm&, GC::Ref<Infrastructure::Response>, Headers::Guard);
|
||||
static WebIDL::ExceptionOr<GC::Ref<Response>> construct_impl(JS::Realm&, Optional<BodyInit> const& body = {}, ResponseInit const& init = {});
|
||||
|
||||
virtual ~Response() override;
|
||||
|
||||
// ^BodyMixin
|
||||
virtual Optional<MimeSniff::MimeType> mime_type_impl() const override;
|
||||
virtual JS::GCPtr<Infrastructure::Body> body_impl() override;
|
||||
virtual JS::GCPtr<Infrastructure::Body const> body_impl() const override;
|
||||
virtual GC::Ptr<Infrastructure::Body> body_impl() override;
|
||||
virtual GC::Ptr<Infrastructure::Body const> body_impl() const override;
|
||||
virtual Bindings::PlatformObject& as_platform_object() override { return *this; }
|
||||
virtual Bindings::PlatformObject const& as_platform_object() const override { return *this; }
|
||||
|
||||
[[nodiscard]] JS::NonnullGCPtr<Infrastructure::Response> response() const { return m_response; }
|
||||
[[nodiscard]] GC::Ref<Infrastructure::Response> response() const { return m_response; }
|
||||
|
||||
// JS API functions
|
||||
[[nodiscard]] static JS::NonnullGCPtr<Response> error(JS::VM&);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> redirect(JS::VM&, String const& url, u16 status);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> json(JS::VM&, JS::Value data, ResponseInit const& init = {});
|
||||
[[nodiscard]] static GC::Ref<Response> error(JS::VM&);
|
||||
static WebIDL::ExceptionOr<GC::Ref<Response>> redirect(JS::VM&, String const& url, u16 status);
|
||||
static WebIDL::ExceptionOr<GC::Ref<Response>> json(JS::VM&, JS::Value data, ResponseInit const& init = {});
|
||||
[[nodiscard]] Bindings::ResponseType type() const;
|
||||
[[nodiscard]] String url() const;
|
||||
[[nodiscard]] bool redirected() const;
|
||||
[[nodiscard]] u16 status() const;
|
||||
[[nodiscard]] bool ok() const;
|
||||
[[nodiscard]] String status_text() const;
|
||||
[[nodiscard]] JS::NonnullGCPtr<Headers> headers() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> clone() const;
|
||||
[[nodiscard]] GC::Ref<Headers> headers() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<GC::Ref<Response>> clone() const;
|
||||
|
||||
// Pull in json() from the BodyMixin, which gets lost due to the static json() above
|
||||
using BodyMixin::json;
|
||||
|
||||
private:
|
||||
Response(JS::Realm&, JS::NonnullGCPtr<Infrastructure::Response>);
|
||||
Response(JS::Realm&, GC::Ref<Infrastructure::Response>);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -74,11 +74,11 @@ private:
|
|||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-response
|
||||
// A Response object has an associated response (a response).
|
||||
JS::NonnullGCPtr<Infrastructure::Response> m_response;
|
||||
GC::Ref<Infrastructure::Response> m_response;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#response-headers
|
||||
// A Response object also has an associated headers (null or a Headers object), initially null.
|
||||
JS::GCPtr<Headers> m_headers;
|
||||
GC::Ptr<Headers> m_headers;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue