mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-11 13:42: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
|
@ -7,8 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibCrypto/PK/RSA.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibWeb/Bindings/CryptoKeyPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
@ -21,13 +21,13 @@ class CryptoKey final
|
|||
: public Bindings::PlatformObject
|
||||
, public Bindings::Serializable {
|
||||
WEB_PLATFORM_OBJECT(CryptoKey, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(CryptoKey);
|
||||
GC_DECLARE_ALLOCATOR(CryptoKey);
|
||||
|
||||
public:
|
||||
using InternalKeyData = Variant<ByteBuffer, Bindings::JsonWebKey, ::Crypto::PK::RSAPublicKey<>, ::Crypto::PK::RSAPrivateKey<>>;
|
||||
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CryptoKey> create(JS::Realm&, InternalKeyData);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CryptoKey> create(JS::Realm&);
|
||||
[[nodiscard]] static GC::Ref<CryptoKey> create(JS::Realm&, InternalKeyData);
|
||||
[[nodiscard]] static GC::Ref<CryptoKey> create(JS::Realm&);
|
||||
|
||||
virtual ~CryptoKey() override;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
void set_extractable(bool extractable) { m_extractable = extractable; }
|
||||
void set_type(Bindings::KeyType type) { m_type = type; }
|
||||
void set_algorithm(JS::NonnullGCPtr<Object> algorithm) { m_algorithm = move(algorithm); }
|
||||
void set_algorithm(GC::Ref<Object> algorithm) { m_algorithm = move(algorithm); }
|
||||
void set_usages(Vector<Bindings::KeyUsage>);
|
||||
|
||||
InternalKeyData const& handle() const { return m_key_data; }
|
||||
|
@ -59,8 +59,8 @@ private:
|
|||
|
||||
Bindings::KeyType m_type;
|
||||
bool m_extractable { false };
|
||||
JS::NonnullGCPtr<Object> m_algorithm;
|
||||
JS::NonnullGCPtr<Object> m_usages;
|
||||
GC::Ref<Object> m_algorithm;
|
||||
GC::Ref<Object> m_usages;
|
||||
|
||||
Vector<Bindings::KeyUsage> m_key_usages;
|
||||
InternalKeyData m_key_data; // [[handle]]
|
||||
|
@ -70,25 +70,25 @@ private:
|
|||
// https://w3c.github.io/webcrypto/#ref-for-dfn-CryptoKeyPair-2
|
||||
class CryptoKeyPair : public JS::Object {
|
||||
JS_OBJECT(CryptoKeyPair, JS::Object);
|
||||
JS_DECLARE_ALLOCATOR(CryptoKeyPair);
|
||||
GC_DECLARE_ALLOCATOR(CryptoKeyPair);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<CryptoKeyPair> create(JS::Realm&, JS::NonnullGCPtr<CryptoKey> public_key, JS::NonnullGCPtr<CryptoKey> private_key);
|
||||
static GC::Ref<CryptoKeyPair> create(JS::Realm&, GC::Ref<CryptoKey> public_key, GC::Ref<CryptoKey> private_key);
|
||||
virtual ~CryptoKeyPair() override = default;
|
||||
|
||||
JS::NonnullGCPtr<CryptoKey> public_key() const { return m_public_key; }
|
||||
JS::NonnullGCPtr<CryptoKey> private_key() const { return m_private_key; }
|
||||
GC::Ref<CryptoKey> public_key() const { return m_public_key; }
|
||||
GC::Ref<CryptoKey> private_key() const { return m_private_key; }
|
||||
|
||||
private:
|
||||
CryptoKeyPair(JS::Realm&, JS::NonnullGCPtr<CryptoKey> public_key, JS::NonnullGCPtr<CryptoKey> private_key);
|
||||
CryptoKeyPair(JS::Realm&, GC::Ref<CryptoKey> public_key, GC::Ref<CryptoKey> private_key);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(public_key_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(private_key_getter);
|
||||
|
||||
JS::NonnullGCPtr<CryptoKey> m_public_key;
|
||||
JS::NonnullGCPtr<CryptoKey> m_private_key;
|
||||
GC::Ref<CryptoKey> m_public_key;
|
||||
GC::Ref<CryptoKey> m_private_key;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue