| 1259 | } |
| 1260 | |
| 1261 | jsi::WeakObject V8Runtime::createWeakObject(const jsi::Object &weakObject) { |
| 1262 | v8::Locker locker(isolate_); |
| 1263 | v8::Isolate::Scope scopedIsolate(isolate_); |
| 1264 | v8::HandleScope scopedHandle(isolate_); |
| 1265 | v8::Context::Scope scopedContext(context_.Get(isolate_)); |
| 1266 | |
| 1267 | const V8PointerValue *v8PointerValue = |
| 1268 | static_cast<const V8PointerValue *>(getPointerValue(weakObject)); |
| 1269 | assert(v8PointerValue->Get(isolate_)->IsObject()); |
| 1270 | |
| 1271 | v8::Global<v8::Value> weakRef = |
| 1272 | v8::Global<v8::Value>(isolate_, v8PointerValue->Get(isolate_)); |
| 1273 | weakRef.SetWeak(); |
| 1274 | return make<jsi::WeakObject>( |
| 1275 | new V8PointerValue(isolate_, std::move(weakRef))); |
| 1276 | } |
| 1277 | |
| 1278 | #if REACT_NATIVE_MINOR_VERSION >= 72 |
| 1279 | jsi::Value V8Runtime::lockWeakObject(const jsi::WeakObject &weakObject) { |