Don't enqueue another UI operation if we're already on the UI thread

Reviewed By: alexeylang

Differential Revision: D5085488

fbshipit-source-id: 0613c1403a67d63ad06ce2db9950d902f1c6473a
This commit is contained in:
Aaron Chiu 2017-05-20 20:40:03 -07:00 committed by Facebook Github Bot
parent 2bf512b58c
commit 213ea30346
1 changed files with 1 additions and 7 deletions

View File

@ -105,13 +105,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
mWasMeasured = true; mWasMeasured = true;
// Check if we were waiting for onMeasure to attach the root view. // Check if we were waiting for onMeasure to attach the root view.
if (mReactInstanceManager != null && !mIsAttachedToInstance) { if (mReactInstanceManager != null && !mIsAttachedToInstance) {
// Enqueue it to UIThread not to block onMeasure waiting for the catalyst instance creation. attachToReactInstanceManager();
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
attachToReactInstanceManager();
}
});
} }
} finally { } finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);