Move cleanup back to destructor

Reviewed By: javache

Differential Revision: D5697611

fbshipit-source-id: e8bce63aec02d08421eea52b20343576e914e5aa
This commit is contained in:
Kathy Gray 2017-08-24 07:55:43 -07:00 committed by Facebook Github Bot
parent 79fdb91bb7
commit f266ab9bac
3 changed files with 3 additions and 10 deletions

View File

@ -329,7 +329,6 @@ public class CatalystInstanceImpl implements CatalystInstance {
UiThreadUtil.runOnUiThread(new Runnable() { UiThreadUtil.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
quitQueuesSynchronous();
mHybridData.resetNative(); mHybridData.resetNative();
// Kill non-UI threads from UI thread. // Kill non-UI threads from UI thread.
getReactQueueConfiguration().destroy(); getReactQueueConfiguration().destroy();
@ -343,8 +342,6 @@ public class CatalystInstanceImpl implements CatalystInstance {
Systrace.unregisterListener(mTraceListener); Systrace.unregisterListener(mTraceListener);
} }
private native void quitQueuesSynchronous();
@Override @Override
public boolean isDestroyed() { public boolean isDestroyed() {
return mDestroyed; return mDestroyed;

View File

@ -85,10 +85,9 @@ CatalystInstanceImpl::CatalystInstanceImpl()
: instance_(folly::make_unique<Instance>()) {} : instance_(folly::make_unique<Instance>()) {}
CatalystInstanceImpl::~CatalystInstanceImpl() { CatalystInstanceImpl::~CatalystInstanceImpl() {
} if (moduleMessageQueue_ != NULL) {
void CatalystInstanceImpl::quitQueuesSynchronous() {
moduleMessageQueue_->quitSynchronous(); moduleMessageQueue_->quitSynchronous();
}
if (uiBackgroundMessageQueue_ != NULL) { if (uiBackgroundMessageQueue_ != NULL) {
uiBackgroundMessageQueue_->quitSynchronous(); uiBackgroundMessageQueue_->quitSynchronous();
} }
@ -98,7 +97,6 @@ void CatalystInstanceImpl::registerNatives() {
registerHybrid({ registerHybrid({
makeNativeMethod("initHybrid", CatalystInstanceImpl::initHybrid), makeNativeMethod("initHybrid", CatalystInstanceImpl::initHybrid),
makeNativeMethod("initializeBridge", CatalystInstanceImpl::initializeBridge), makeNativeMethod("initializeBridge", CatalystInstanceImpl::initializeBridge),
makeNativeMethod("quitQueuesSynchronous", CatalystInstanceImpl::quitQueuesSynchronous),
makeNativeMethod("jniExtendNativeModules", CatalystInstanceImpl::extendNativeModules), makeNativeMethod("jniExtendNativeModules", CatalystInstanceImpl::extendNativeModules),
makeNativeMethod("jniSetSourceURL", CatalystInstanceImpl::jniSetSourceURL), makeNativeMethod("jniSetSourceURL", CatalystInstanceImpl::jniSetSourceURL),
makeNativeMethod("jniLoadScriptFromAssets", CatalystInstanceImpl::jniLoadScriptFromAssets), makeNativeMethod("jniLoadScriptFromAssets", CatalystInstanceImpl::jniLoadScriptFromAssets),

View File

@ -35,8 +35,6 @@ class CatalystInstanceImpl : public jni::HybridClass<CatalystInstanceImpl> {
return instance_; return instance_;
} }
void quitQueuesSynchronous();
private: private:
friend HybridBase; friend HybridBase;