MCPcopy Create free account
hub / github.com/expo/expo / lock

Method lock

packages/expo-modules-core/android/src/main/cpp/JavaScriptWeakObject.cpp:18–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18jni::local_ref<JavaScriptObject::javaobject> JavaScriptWeakObject::lock() {
19 auto jsRuntime = _runtimeHolder.lock();
20 assert((jsRuntime != nullptr) && "JS Runtime was used after deallocation");
21 auto &rawRuntime = jsRuntime->get();
22
23 jsi::Value value = _weakObject->lock(rawRuntime);
24 if (value.isUndefined()) {
25 return nullptr;
26 }
27 std::shared_ptr<jsi::Object> objectPtr =
28 std::make_shared<jsi::Object>(value.asObject(rawRuntime));
29 if (!objectPtr) {
30 return nullptr;
31 }
32 return JavaScriptObject::newInstance(
33 expo::getJSIContext(rawRuntime),
34 _runtimeHolder, objectPtr
35 );
36}
37
38jni::local_ref<jni::HybridClass<JavaScriptWeakObject, Destructible>::javaobject>
39JavaScriptWeakObject::newInstance(

Callers 15

cancelMethod · 0.45
submitMethod · 0.45
closeDatabaseMethod · 0.45
closeDatabaseMethod · 0.45
addMethod · 0.45
removeMethod · 0.45
registerOpenFileMethod · 0.45
unregisterOpenFileMethod · 0.45
fileIsOpenMethod · 0.45
MediaInfoClass · 0.45
addDataRangeMethod · 0.45

Calls 5

getJSIContextFunction · 0.85
getMethod · 0.65
assertFunction · 0.50
isUndefinedMethod · 0.45
asObjectMethod · 0.45

Tested by 15

cancelMethod · 0.36
submitMethod · 0.36
invokeAsyncMethod · 0.36
invokeSyncMethod · 0.36
logMethod · 0.36
downloadAssetMethod · 0.36
runMethod · 0.36