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:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Heap/Heap.h>
#include <LibGC/Heap.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Fetch/Fetching/PendingResponse.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
@ -12,19 +12,19 @@
namespace Web::Fetch::Fetching {
JS_DEFINE_ALLOCATOR(PendingResponse);
GC_DEFINE_ALLOCATOR(PendingResponse);
JS::NonnullGCPtr<PendingResponse> PendingResponse::create(JS::VM& vm, JS::NonnullGCPtr<Infrastructure::Request> request)
GC::Ref<PendingResponse> PendingResponse::create(JS::VM& vm, GC::Ref<Infrastructure::Request> request)
{
return vm.heap().allocate<PendingResponse>(request);
}
JS::NonnullGCPtr<PendingResponse> PendingResponse::create(JS::VM& vm, JS::NonnullGCPtr<Infrastructure::Request> request, JS::NonnullGCPtr<Infrastructure::Response> response)
GC::Ref<PendingResponse> PendingResponse::create(JS::VM& vm, GC::Ref<Infrastructure::Request> request, GC::Ref<Infrastructure::Response> response)
{
return vm.heap().allocate<PendingResponse>(request, response);
}
PendingResponse::PendingResponse(JS::NonnullGCPtr<Infrastructure::Request> request, JS::GCPtr<Infrastructure::Response> response)
PendingResponse::PendingResponse(GC::Ref<Infrastructure::Request> request, GC::Ptr<Infrastructure::Response> response)
: m_request(request)
, m_response(response)
{
@ -42,12 +42,12 @@ void PendingResponse::visit_edges(JS::Cell::Visitor& visitor)
void PendingResponse::when_loaded(Callback callback)
{
VERIFY(!m_callback);
m_callback = JS::create_heap_function(heap(), move(callback));
m_callback = GC::create_function(heap(), move(callback));
if (m_response)
run_callback();
}
void PendingResponse::resolve(JS::NonnullGCPtr<Infrastructure::Response> response)
void PendingResponse::resolve(GC::Ref<Infrastructure::Response> response)
{
VERIFY(!m_response);
m_response = response;
@ -59,7 +59,7 @@ void PendingResponse::run_callback()
{
VERIFY(m_callback);
VERIFY(m_response);
Platform::EventLoopPlugin::the().deferred_invoke(JS::create_heap_function(heap(), [this] {
Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(heap(), [this] {
VERIFY(m_callback);
VERIFY(m_response);
m_callback->function()(*m_response);