Make ShadowNodeRegistry thread safe

Reviewed By: achen1

Differential Revision: D7679621

fbshipit-source-id: 1003578edcf9107b736d876dac969f22f9e62b6d
This commit is contained in:
David Vacca 2018-04-19 10:46:33 -07:00 committed by Facebook Github Bot
parent 3aa453d975
commit dc836780cb
2 changed files with 7 additions and 4 deletions

View File

@ -28,9 +28,7 @@ public class ShadowNodeRegistry {
}
public void addRootNode(ReactShadowNode node) {
// TODO(6242243): This should be asserted... but UIManagerModule is
// thread-unsafe and calls this on the wrong thread.
//mThreadAsserter.assertNow();
mThreadAsserter.assertNow();
int tag = node.getReactTag();
mTagsToCSSNodes.put(tag, node);
mRootTags.put(tag, true);

View File

@ -205,7 +205,12 @@ public class UIImplementation {
int heightMeasureSpec = rootView.getHeightMeasureSpec();
updateRootView(rootCSSNode, widthMeasureSpec, heightMeasureSpec);
mShadowNodeRegistry.addRootNode(rootCSSNode);
context.runOnNativeModulesQueueThread(new Runnable() {
@Override
public void run() {
mShadowNodeRegistry.addRootNode(rootCSSNode);
}
});
// register it within NativeViewHierarchyManager
mOperationsQueue.addRootView(tag, rootView, context);