mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +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
				
			
		|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/Array.h> | ||||
| #include <LibJS/Heap/Heap.h> | ||||
| #include <LibGC/Heap.h> | ||||
| #include <LibJS/Runtime/Realm.h> | ||||
| #include <LibWeb/DOMURL/DOMURL.h> | ||||
| #include <LibWeb/Fetch/Fetching/PendingResponse.h> | ||||
|  | @ -13,9 +13,9 @@ | |||
| 
 | ||||
| namespace Web::Fetch::Infrastructure { | ||||
| 
 | ||||
| JS_DEFINE_ALLOCATOR(Request); | ||||
| GC_DEFINE_ALLOCATOR(Request); | ||||
| 
 | ||||
| Request::Request(JS::NonnullGCPtr<HeaderList> header_list) | ||||
| Request::Request(GC::Ref<HeaderList> header_list) | ||||
|     : m_header_list(header_list) | ||||
| { | ||||
| } | ||||
|  | @ -26,16 +26,16 @@ void Request::visit_edges(JS::Cell::Visitor& visitor) | |||
|     visitor.visit(m_header_list); | ||||
|     visitor.visit(m_client); | ||||
|     m_body.visit( | ||||
|         [&](JS::NonnullGCPtr<Body>& body) { visitor.visit(body); }, | ||||
|         [&](GC::Ref<Body>& body) { visitor.visit(body); }, | ||||
|         [](auto&) {}); | ||||
|     visitor.visit(m_reserved_client); | ||||
|     m_window.visit( | ||||
|         [&](JS::GCPtr<HTML::EnvironmentSettingsObject> const& value) { visitor.visit(value); }, | ||||
|         [&](GC::Ptr<HTML::EnvironmentSettingsObject> const& value) { visitor.visit(value); }, | ||||
|         [](auto const&) {}); | ||||
|     visitor.visit(m_pending_responses); | ||||
| } | ||||
| 
 | ||||
| JS::NonnullGCPtr<Request> Request::create(JS::VM& vm) | ||||
| GC::Ref<Request> Request::create(JS::VM& vm) | ||||
| { | ||||
|     return vm.heap().allocate<Request>(HeaderList::create(vm)); | ||||
| } | ||||
|  | @ -205,7 +205,7 @@ ByteBuffer Request::byte_serialize_origin() const | |||
| } | ||||
| 
 | ||||
| // https://fetch.spec.whatwg.org/#concept-request-clone
 | ||||
| JS::NonnullGCPtr<Request> Request::clone(JS::Realm& realm) const | ||||
| GC::Ref<Request> Request::clone(JS::Realm& realm) const | ||||
| { | ||||
|     // To clone a request request, run these steps:
 | ||||
|     auto& vm = realm.vm(); | ||||
|  | @ -253,7 +253,7 @@ JS::NonnullGCPtr<Request> Request::clone(JS::Realm& realm) const | |||
|     new_request->set_buffer_policy(m_buffer_policy); | ||||
| 
 | ||||
|     // 2. If request’s body is non-null, set newRequest’s body to the result of cloning request’s body.
 | ||||
|     if (auto const* body = m_body.get_pointer<JS::NonnullGCPtr<Body>>()) | ||||
|     if (auto const* body = m_body.get_pointer<GC::Ref<Body>>()) | ||||
|         new_request->set_body((*body)->clone(realm)); | ||||
| 
 | ||||
|     // 3. Return newRequest.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Shannon Booth
						Shannon Booth