mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "Pass in EventEmitter during View CREATE and Preallocation"
Summary: Original commit changeset: ae4c8b4eefe6 Reverting temporarily to resolve T92179998. Changelog: [Internal] Reviewed By: fkgozali, sammy-SC Differential Revision: D28938467 fbshipit-source-id: a855c8f08f4826e0bb4b918f2dd3269f200787f5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a403e76177
commit
e15f171080
@@ -625,7 +625,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
final String componentName,
|
||||
@Nullable ReadableMap props,
|
||||
@Nullable Object stateWrapper,
|
||||
@Nullable Object eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
|
||||
mMountItemDispatcher.addPreAllocateMountItem(
|
||||
@@ -635,7 +634,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
getFabricComponentName(componentName),
|
||||
props,
|
||||
(StateWrapper) stateWrapper,
|
||||
(EventEmitterWrapper) eventEmitterWrapper,
|
||||
isLayoutable));
|
||||
}
|
||||
|
||||
|
||||
@@ -169,8 +169,7 @@ static inline void computeBufferSizes(
|
||||
|
||||
batchMountItemIntsSize += getIntBufferSizeForType(mountItemType);
|
||||
if (mountItemType == CppMountItem::Type::Create) {
|
||||
batchMountItemObjectsSize +=
|
||||
4; // component name, props, state, event emitter
|
||||
batchMountItemObjectsSize += 3; // component name, props, state
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,13 +884,6 @@ void Binding::schedulerDidFinishTransaction(
|
||||
cStateWrapper->state_ = mountItem.newChildShadowView.state;
|
||||
}
|
||||
|
||||
// Do not hold a reference to javaEventEmitter from the C++ side.
|
||||
SharedEventEmitter eventEmitter =
|
||||
mountItem.newChildShadowView.eventEmitter;
|
||||
auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs();
|
||||
EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter);
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
|
||||
temp[0] = mountItem.newChildShadowView.tag;
|
||||
temp[1] = isLayoutable;
|
||||
env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp);
|
||||
@@ -901,7 +893,6 @@ void Binding::schedulerDidFinishTransaction(
|
||||
(*objBufferArray)[objBufferPosition++] = props.get();
|
||||
(*objBufferArray)[objBufferPosition++] =
|
||||
javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr;
|
||||
(*objBufferArray)[objBufferPosition++] = javaEventEmitter.get();
|
||||
} else if (mountItemType == CppMountItem::Type::Insert) {
|
||||
temp[0] = mountItem.newChildShadowView.tag;
|
||||
temp[1] = mountItem.parentShadowView.tag;
|
||||
@@ -1152,13 +1143,8 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation(
|
||||
static auto preallocateView =
|
||||
jni::findClassStatic(Binding::UIManagerJavaDescriptor)
|
||||
->getMethod<void(
|
||||
jint,
|
||||
jint,
|
||||
jstring,
|
||||
ReadableMap::javaobject,
|
||||
jobject,
|
||||
jobject,
|
||||
jboolean)>("preallocateView");
|
||||
jint, jint, jstring, ReadableMap::javaobject, jobject, jboolean)>(
|
||||
"preallocateView");
|
||||
|
||||
// Do not hold onto Java object from C
|
||||
// We DO want to hold onto C object from Java, since we don't know the
|
||||
@@ -1170,12 +1156,6 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation(
|
||||
cStateWrapper->state_ = shadowView.state;
|
||||
}
|
||||
|
||||
// Do not hold a reference to javaEventEmitter from the C++ side.
|
||||
SharedEventEmitter eventEmitter = shadowView.eventEmitter;
|
||||
auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs();
|
||||
EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter);
|
||||
cEventEmitter->eventEmitter = eventEmitter;
|
||||
|
||||
local_ref<ReadableMap::javaobject> props = castReadableMap(
|
||||
ReadableNativeMap::newObjectCxxArgs(shadowView.props->rawProps));
|
||||
auto component = getPlatformComponentName(shadowView);
|
||||
@@ -1187,7 +1167,6 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation(
|
||||
component.get(),
|
||||
props.get(),
|
||||
(javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr),
|
||||
javaEventEmitter.get(),
|
||||
isLayoutableShadowNode);
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -529,7 +529,6 @@ public class SurfaceMountingManager {
|
||||
int reactTag,
|
||||
@Nullable ReadableMap props,
|
||||
@Nullable StateWrapper stateWrapper,
|
||||
@Nullable EventEmitterWrapper eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
if (isStopped()) {
|
||||
return;
|
||||
@@ -557,7 +556,6 @@ public class SurfaceMountingManager {
|
||||
ViewState viewState = new ViewState(reactTag, view, viewManager);
|
||||
viewState.mCurrentProps = propsDiffMap;
|
||||
viewState.mStateWrapper = stateWrapper;
|
||||
viewState.mEventEmitter = eventEmitterWrapper;
|
||||
|
||||
mTagToViewState.put(reactTag, viewState);
|
||||
}
|
||||
@@ -847,7 +845,6 @@ public class SurfaceMountingManager {
|
||||
int reactTag,
|
||||
@Nullable ReadableMap props,
|
||||
@Nullable StateWrapper stateWrapper,
|
||||
@Nullable EventEmitterWrapper eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
if (isStopped()) {
|
||||
@@ -859,7 +856,7 @@ public class SurfaceMountingManager {
|
||||
"View for component " + componentName + " with tag " + reactTag + " already exists.");
|
||||
}
|
||||
|
||||
createView(componentName, reactTag, props, stateWrapper, eventEmitterWrapper, isLayoutable);
|
||||
createView(componentName, reactTag, props, stateWrapper, isLayoutable);
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
|
||||
+1
-2
@@ -142,7 +142,6 @@ public class IntBufferBatchMountItem implements MountItem {
|
||||
mIntBuffer[i++],
|
||||
castToProps(mObjBuffer[j++]),
|
||||
castToState(mObjBuffer[j++]),
|
||||
castToEventEmitter(mObjBuffer[j++]),
|
||||
mIntBuffer[i++] == 1);
|
||||
} else if (type == INSTRUCTION_DELETE) {
|
||||
surfaceMountingManager.deleteView(mIntBuffer[i++]);
|
||||
@@ -203,7 +202,7 @@ public class IntBufferBatchMountItem implements MountItem {
|
||||
for (int k = 0; k < numInstructions; k++) {
|
||||
if (type == INSTRUCTION_CREATE) {
|
||||
String componentName = getFabricComponentName((String) mObjBuffer[j++]);
|
||||
j += 3;
|
||||
j += 2;
|
||||
s.append(
|
||||
String.format(
|
||||
"CREATE [%d] - layoutable:%d - %s\n",
|
||||
|
||||
+1
-5
@@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.fabric.events.EventEmitterWrapper;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
import com.facebook.react.fabric.mounting.SurfaceMountingManager;
|
||||
import com.facebook.react.uimanager.StateWrapper;
|
||||
@@ -27,7 +26,6 @@ public class PreAllocateViewMountItem implements MountItem {
|
||||
private final int mReactTag;
|
||||
private final @Nullable ReadableMap mProps;
|
||||
private final @Nullable StateWrapper mStateWrapper;
|
||||
private final @Nullable EventEmitterWrapper mEventEmitterWrapper;
|
||||
private final boolean mIsLayoutable;
|
||||
|
||||
public PreAllocateViewMountItem(
|
||||
@@ -36,13 +34,11 @@ public class PreAllocateViewMountItem implements MountItem {
|
||||
@NonNull String component,
|
||||
@Nullable ReadableMap props,
|
||||
@NonNull StateWrapper stateWrapper,
|
||||
@Nullable EventEmitterWrapper eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
mComponent = component;
|
||||
mSurfaceId = surfaceId;
|
||||
mProps = props;
|
||||
mStateWrapper = stateWrapper;
|
||||
mEventEmitterWrapper = eventEmitterWrapper;
|
||||
mReactTag = reactTag;
|
||||
mIsLayoutable = isLayoutable;
|
||||
}
|
||||
@@ -62,7 +58,7 @@ public class PreAllocateViewMountItem implements MountItem {
|
||||
return;
|
||||
}
|
||||
surfaceMountingManager.preallocateView(
|
||||
mComponent, mReactTag, mProps, mStateWrapper, mEventEmitterWrapper, mIsLayoutable);
|
||||
mComponent, mReactTag, mProps, mStateWrapper, mIsLayoutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user