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
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

@ -7,7 +7,7 @@
#pragma once
#include <AK/HashMap.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibGC/Ptr.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/IndexedDB/IDBDatabase.h>
#include <LibWeb/IndexedDB/IDBRequest.h>
@ -18,18 +18,18 @@ namespace Web::IndexedDB {
// https://www.w3.org/TR/IndexedDB/#database-construct
class Database : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Database, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(Database);
GC_DECLARE_ALLOCATOR(Database);
public:
void set_version(u64 version) { m_version = version; }
u64 version() const { return m_version; }
String name() const { return m_name; }
void associate(JS::NonnullGCPtr<IDBDatabase> connection) { m_associated_connections.append(connection); }
ReadonlySpan<JS::NonnullGCPtr<IDBDatabase>> associated_connections() { return m_associated_connections; }
Vector<JS::Handle<IDBDatabase>> associated_connections_except(IDBDatabase& connection)
void associate(GC::Ref<IDBDatabase> connection) { m_associated_connections.append(connection); }
ReadonlySpan<GC::Ref<IDBDatabase>> associated_connections() { return m_associated_connections; }
Vector<GC::Root<IDBDatabase>> associated_connections_except(IDBDatabase& connection)
{
Vector<JS::Handle<IDBDatabase>> connections;
Vector<GC::Root<IDBDatabase>> connections;
for (auto& associated_connection : m_associated_connections) {
if (associated_connection != &connection)
connections.append(associated_connection);
@ -37,11 +37,11 @@ public:
return connections;
}
[[nodiscard]] static Optional<JS::Handle<Database>> for_key_and_name(StorageAPI::StorageKey&, String&);
[[nodiscard]] static ErrorOr<JS::Handle<Database>> create_for_key_and_name(JS::Realm&, StorageAPI::StorageKey&, String&);
[[nodiscard]] static Optional<GC::Root<Database>> for_key_and_name(StorageAPI::StorageKey&, String&);
[[nodiscard]] static ErrorOr<GC::Root<Database>> create_for_key_and_name(JS::Realm&, StorageAPI::StorageKey&, String&);
[[nodiscard]] static ErrorOr<void> delete_for_key_and_name(StorageAPI::StorageKey&, String&);
[[nodiscard]] static JS::NonnullGCPtr<Database> create(JS::Realm&, String const&);
[[nodiscard]] static GC::Ref<Database> create(JS::Realm&, String const&);
virtual ~Database();
protected:
@ -56,7 +56,7 @@ protected:
virtual void visit_edges(Visitor&) override;
private:
Vector<JS::NonnullGCPtr<IDBDatabase>> m_associated_connections;
Vector<GC::Ref<IDBDatabase>> m_associated_connections;
// FIXME: A database has zero or more object stores which hold the data stored in the database.