mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-12 12:01:52 +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
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableStreamBYOBReader);
|
||||
GC_DEFINE_ALLOCATOR(ReadableStreamBYOBReader);
|
||||
|
||||
ReadableStreamBYOBReader::ReadableStreamBYOBReader(JS::Realm& realm)
|
||||
: Bindings::PlatformObject(realm)
|
||||
|
@ -32,7 +32,7 @@ void ReadableStreamBYOBReader::initialize(JS::Realm& realm)
|
|||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#byob-reader-constructor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamBYOBReader>> ReadableStreamBYOBReader::construct_impl(JS::Realm& realm, JS::NonnullGCPtr<ReadableStream> stream)
|
||||
WebIDL::ExceptionOr<GC::Ref<ReadableStreamBYOBReader>> ReadableStreamBYOBReader::construct_impl(JS::Realm& realm, GC::Ref<ReadableStream> stream)
|
||||
{
|
||||
auto reader = realm.create<ReadableStreamBYOBReader>(realm);
|
||||
|
||||
|
@ -61,8 +61,8 @@ void ReadableStreamBYOBReader::visit_edges(Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
class BYOBReaderReadIntoRequest : public ReadIntoRequest {
|
||||
JS_CELL(BYOBReaderReadIntoRequest, ReadIntoRequest);
|
||||
JS_DECLARE_ALLOCATOR(BYOBReaderReadIntoRequest);
|
||||
GC_CELL(BYOBReaderReadIntoRequest, ReadIntoRequest);
|
||||
GC_DECLARE_ALLOCATOR(BYOBReaderReadIntoRequest);
|
||||
|
||||
public:
|
||||
BYOBReaderReadIntoRequest(JS::Realm& realm, WebIDL::Promise& promise)
|
||||
|
@ -100,14 +100,14 @@ private:
|
|||
visitor.visit(m_promise);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<JS::Realm> m_realm;
|
||||
JS::NonnullGCPtr<WebIDL::Promise> m_promise;
|
||||
GC::Ref<JS::Realm> m_realm;
|
||||
GC::Ref<WebIDL::Promise> m_promise;
|
||||
};
|
||||
|
||||
JS_DEFINE_ALLOCATOR(BYOBReaderReadIntoRequest);
|
||||
GC_DEFINE_ALLOCATOR(BYOBReaderReadIntoRequest);
|
||||
|
||||
// https://streams.spec.whatwg.org/#byob-reader-read
|
||||
JS::NonnullGCPtr<WebIDL::Promise> ReadableStreamBYOBReader::read(JS::Handle<WebIDL::ArrayBufferView>& view, ReadableStreamBYOBReaderReadOptions options)
|
||||
GC::Ref<WebIDL::Promise> ReadableStreamBYOBReader::read(GC::Root<WebIDL::ArrayBufferView>& view, ReadableStreamBYOBReaderReadOptions options)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
|
@ -137,7 +137,7 @@ JS::NonnullGCPtr<WebIDL::Promise> ReadableStreamBYOBReader::read(JS::Handle<WebI
|
|||
|
||||
// 5. If view has a [[TypedArrayName]] internal slot,
|
||||
if (view->is_typed_array_base()) {
|
||||
auto const& typed_array = *view->bufferable_object().get<JS::NonnullGCPtr<JS::TypedArrayBase>>();
|
||||
auto const& typed_array = *view->bufferable_object().get<GC::Ref<JS::TypedArrayBase>>();
|
||||
|
||||
// 1. If options["min"] > view.[[ArrayLength]], return a promise rejected with a RangeError exception.
|
||||
if (options.min > typed_array.array_length().length()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue