Skip unnecessary string allocs from frquently executed code paths.

Differential Revision: D2540814

fb-gh-sync-id: 045d012b52a6bc89d409bcc028532da1760c5775
This commit is contained in:
Krzysztof Magiera
2015-10-14 09:21:52 -07:00
committed by facebook-github-bot-6
parent aae9f0255f
commit 10a9b94b9c
3 changed files with 20 additions and 9 deletions

View File

@@ -27,13 +27,11 @@ import com.facebook.react.animation.AnimationListener;
import com.facebook.react.animation.AnimationRegistry;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.SoftAssertions;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.touch.JSResponderHandler;
import com.facebook.react.uimanager.events.EventDispatcher;
/**
* Delegate of {@link UIManagerModule} that owns the native view hierarchy and mapping between
@@ -420,9 +418,10 @@ import com.facebook.react.uimanager.events.EventDispatcher;
public void removeRootView(int rootViewTag) {
UiThreadUtil.assertOnUiThread();
SoftAssertions.assertCondition(
mRootTags.get(rootViewTag),
"View with tag " + rootViewTag + " is not registered as a root view");
if (!mRootTags.get(rootViewTag)) {
SoftAssertions.assertUnreachable(
"View with tag " + rootViewTag + " is not registered as a root view");
}
View rootView = mTagsToViews.get(rootViewTag);
dropView(rootView);
mRootTags.delete(rootViewTag);
@@ -455,9 +454,10 @@ import com.facebook.react.uimanager.events.EventDispatcher;
}
public void setJSResponder(int reactTag, boolean blockNativeResponder) {
SoftAssertions.assertCondition(
!mRootTags.get(reactTag),
"Cannot block native responder on " + reactTag + " that is a root view");
if (mRootTags.get(reactTag)) {
SoftAssertions.assertUnreachable(
"Cannot block native responder on " + reactTag + " that is a root view");
}
ViewParent viewParent = blockNativeResponder ? mTagsToViews.get(reactTag).getParent() : null;
mJSResponderHandler.setJSResponder(reactTag, viewParent);
}