diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-13 20:49:50 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-14 09:59:45 +0000 |
commit | cac71a6847480df27ee0fbabea291949c2987994 (patch) | |
tree | 8840eb7331e3fb34d7a4f861a46b5fc05a29a69d /Userland/Libraries | |
parent | 3358ddfd0e93ed36d2b31f7db4fcc2d236584edf (diff) | |
download | serenity-cac71a6847480df27ee0fbabea291949c2987994.zip |
LibJS: Convert WeakRef::create() to NonnullGCPtr
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/WeakRef.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/WeakRef.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/WeakRef.cpp b/Userland/Libraries/LibJS/Runtime/WeakRef.cpp index 023ccbcbd4..7ec917f3d9 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRef.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRef.cpp @@ -8,14 +8,14 @@ namespace JS { -WeakRef* WeakRef::create(Realm& realm, Object& value) +NonnullGCPtr<WeakRef> WeakRef::create(Realm& realm, Object& value) { - return realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype()); + return *realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype()); } -WeakRef* WeakRef::create(Realm& realm, Symbol& value) +NonnullGCPtr<WeakRef> WeakRef::create(Realm& realm, Symbol& value) { - return realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype()); + return *realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype()); } WeakRef::WeakRef(Object& value, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/WeakRef.h b/Userland/Libraries/LibJS/Runtime/WeakRef.h index 02d4371baf..df333d2b74 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRef.h +++ b/Userland/Libraries/LibJS/Runtime/WeakRef.h @@ -18,8 +18,8 @@ class WeakRef final JS_OBJECT(WeakRef, Object); public: - static WeakRef* create(Realm&, Object&); - static WeakRef* create(Realm&, Symbol&); + static NonnullGCPtr<WeakRef> create(Realm&, Object&); + static NonnullGCPtr<WeakRef> create(Realm&, Symbol&); virtual ~WeakRef() override = default; |