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

@ -19,10 +19,10 @@ namespace Web::Crypto {
// https://w3c.github.io/webcrypto/#key-algorithm-dictionary
class KeyAlgorithm : public JS::Object {
JS_OBJECT(KeyAlgorithm, JS::Object);
JS_DECLARE_ALLOCATOR(KeyAlgorithm);
GC_DECLARE_ALLOCATOR(KeyAlgorithm);
public:
static JS::NonnullGCPtr<KeyAlgorithm> create(JS::Realm&);
static GC::Ref<KeyAlgorithm> create(JS::Realm&);
virtual ~KeyAlgorithm() override = default;
String const& name() const { return m_name; }
@ -40,24 +40,24 @@ private:
JS_DECLARE_NATIVE_FUNCTION(name_getter);
String m_name;
JS::NonnullGCPtr<JS::Realm> m_realm;
GC::Ref<JS::Realm> m_realm;
};
// https://w3c.github.io/webcrypto/#RsaKeyAlgorithm-dictionary
class RsaKeyAlgorithm : public KeyAlgorithm {
JS_OBJECT(RsaKeyAlgorithm, KeyAlgorithm);
JS_DECLARE_ALLOCATOR(RsaKeyAlgorithm);
GC_DECLARE_ALLOCATOR(RsaKeyAlgorithm);
public:
static JS::NonnullGCPtr<RsaKeyAlgorithm> create(JS::Realm&);
static GC::Ref<RsaKeyAlgorithm> create(JS::Realm&);
virtual ~RsaKeyAlgorithm() override = default;
u32 modulus_length() const { return m_modulus_length; }
void set_modulus_length(u32 modulus_length) { m_modulus_length = modulus_length; }
JS::NonnullGCPtr<JS::Uint8Array> public_exponent() const { return m_public_exponent; }
void set_public_exponent(JS::NonnullGCPtr<JS::Uint8Array> public_exponent) { m_public_exponent = public_exponent; }
GC::Ref<JS::Uint8Array> public_exponent() const { return m_public_exponent; }
void set_public_exponent(GC::Ref<JS::Uint8Array> public_exponent) { m_public_exponent = public_exponent; }
WebIDL::ExceptionOr<void> set_public_exponent(::Crypto::UnsignedBigInteger);
protected:
@ -71,16 +71,16 @@ private:
JS_DECLARE_NATIVE_FUNCTION(public_exponent_getter);
u32 m_modulus_length { 0 };
JS::NonnullGCPtr<JS::Uint8Array> m_public_exponent;
GC::Ref<JS::Uint8Array> m_public_exponent;
};
// https://w3c.github.io/webcrypto/#RsaHashedKeyAlgorithm-dictionary
class RsaHashedKeyAlgorithm : public RsaKeyAlgorithm {
JS_OBJECT(RsaHashedKeyAlgorithm, RsaKeyAlgorithm);
JS_DECLARE_ALLOCATOR(RsaHashedKeyAlgorithm);
GC_DECLARE_ALLOCATOR(RsaHashedKeyAlgorithm);
public:
static JS::NonnullGCPtr<RsaHashedKeyAlgorithm> create(JS::Realm&);
static GC::Ref<RsaHashedKeyAlgorithm> create(JS::Realm&);
virtual ~RsaHashedKeyAlgorithm() override = default;
@ -101,10 +101,10 @@ private:
// https://w3c.github.io/webcrypto/#EcKeyAlgorithm-dictionary
class EcKeyAlgorithm : public KeyAlgorithm {
JS_OBJECT(EcKeyAlgorithm, KeyAlgorithm);
JS_DECLARE_ALLOCATOR(EcKeyAlgorithm);
GC_DECLARE_ALLOCATOR(EcKeyAlgorithm);
public:
static JS::NonnullGCPtr<EcKeyAlgorithm> create(JS::Realm&);
static GC::Ref<EcKeyAlgorithm> create(JS::Realm&);
virtual ~EcKeyAlgorithm() override = default;
@ -125,10 +125,10 @@ private:
// https://w3c.github.io/webcrypto/#AesKeyAlgorithm-dictionary
struct AesKeyAlgorithm : public KeyAlgorithm {
JS_OBJECT(AesKeyAlgorithm, KeyAlgorithm);
JS_DECLARE_ALLOCATOR(AesKeyAlgorithm);
GC_DECLARE_ALLOCATOR(AesKeyAlgorithm);
public:
static JS::NonnullGCPtr<AesKeyAlgorithm> create(JS::Realm&);
static GC::Ref<AesKeyAlgorithm> create(JS::Realm&);
virtual ~AesKeyAlgorithm() override = default;
@ -149,15 +149,15 @@ private:
// https://w3c.github.io/webcrypto/#HmacKeyAlgorithm-dictionary
struct HmacKeyAlgorithm : public KeyAlgorithm {
JS_OBJECT(HmacKeyAlgorithm, KeyAlgorithm);
JS_DECLARE_ALLOCATOR(HmacKeyAlgorithm);
GC_DECLARE_ALLOCATOR(HmacKeyAlgorithm);
public:
static JS::NonnullGCPtr<HmacKeyAlgorithm> create(JS::Realm&);
static GC::Ref<HmacKeyAlgorithm> create(JS::Realm&);
virtual ~HmacKeyAlgorithm() override = default;
JS::GCPtr<KeyAlgorithm> hash() const { return m_hash; }
void set_hash(JS::GCPtr<KeyAlgorithm> hash) { m_hash = hash; }
GC::Ptr<KeyAlgorithm> hash() const { return m_hash; }
void set_hash(GC::Ptr<KeyAlgorithm> hash) { m_hash = hash; }
WebIDL::UnsignedLong length() const { return m_length; }
void set_length(WebIDL::UnsignedLong length) { m_length = length; }
@ -172,7 +172,7 @@ private:
JS_DECLARE_NATIVE_FUNCTION(hash_getter);
JS_DECLARE_NATIVE_FUNCTION(length_getter);
JS::GCPtr<KeyAlgorithm> m_hash;
GC::Ptr<KeyAlgorithm> m_hash;
WebIDL::UnsignedLong m_length;
};