Implement release of FabricUIManager resources

Reviewed By: achen1

Differential Revision: D8232155

fbshipit-source-id: 6683c692a830f5a73aab2c606167e54d668ae5c2
This commit is contained in:
David Vacca
2018-06-01 17:54:50 -07:00
committed by Facebook Github Bot
parent 6aea98441a
commit 8529b1ee91
8 changed files with 59 additions and 8 deletions
@@ -338,10 +338,14 @@ public class CatalystInstanceImpl implements CatalystInstance {
@Override
public void run() {
mNativeModuleRegistry.notifyJSInstanceDestroy();
mJSIModuleRegistry.notifyJSInstanceDestroy();
boolean wasIdle = (mPendingJSCalls.getAndSet(0) == 0);
if (!wasIdle && !mBridgeIdleListeners.isEmpty()) {
if (!mBridgeIdleListeners.isEmpty()) {
for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) {
listener.onTransitionToBridgeIdle();
if (!wasIdle) {
listener.onTransitionToBridgeIdle();
}
listener.onBridgeDestroyed();
}
}
AsyncTask.execute(
@@ -351,7 +355,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
// Kill non-UI threads from neutral third party
// potentially expensive, so don't run on UI thread
// contextHolder is used as a lock to guard against other users of the JS VM having
// contextHolder is used as a lock to guard against other users of the JS VM
// having
// the VM destroyed underneath them, so notify them before we resetNative
mJavaScriptContextHolder.clear();