MCPcopy Create free account
hub / github.com/NativeScript/android / ReleaseJSInstance

Method ReleaseJSInstance

test-app/runtime/src/main/cpp/ObjectManager.cpp:463–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463void ObjectManager::ReleaseJSInstance(Persistent<Object>* po,
464 JSInstanceInfo* jsInstanceInfo) {
465 int javaObjectID = jsInstanceInfo->JavaObjectID;
466
467 auto it = m_idToObject.find(javaObjectID);
468
469 if (it == m_idToObject.end()) {
470 stringstream ss;
471 ss << "(InternalError): Js object with id: " << javaObjectID
472 << " not found";
473 throw NativeScriptException(ss.str());
474 }
475
476 assert(po == it->second);
477
478 m_idToObject.erase(it);
479 m_released.insert(po, javaObjectID);
480 po->Reset();
481
482 delete po;
483 delete jsInstanceInfo;
484
485 DEBUG_WRITE("ReleaseJSObject instance disposed. id:%d", javaObjectID);
486}
487
488/*
489 * The "regular" JS objects added on ObjectManager::JSObjectWeakCallback are

Callers

nothing calls this directly

Calls 6

eraseMethod · 0.80
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected