Skip to content

Commit

Permalink
Back out "Migrate flag enablePropIteratorSetter to new system"
Browse files Browse the repository at this point in the history
Summary:
Original commit changeset: d6fd1e819abb

Original Phabricator Diff: D52810065

Changelog: [Internal]

Reviewed By: lunaleaps, mdvacca

Differential Revision: D53736651

fbshipit-source-id: 1fcf7aa028101f6439dfe34d879a086e9cae71ff
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Feb 14, 2024
1 parent 0378941 commit 093b745
Show file tree
Hide file tree
Showing 42 changed files with 387 additions and 506 deletions.
4 changes: 4 additions & 0 deletions packages/react-native/React/Fabric/RCTSurfacePresenter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ - (RCTScheduler *)_createScheduler
{
auto reactNativeConfig = _contextContainer->at<std::shared_ptr<const ReactNativeConfig>>("ReactNativeConfig");

if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_cpp_props_iterator_setter_ios")) {
CoreFeatures::enablePropIteratorSetter = true;
}

if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_granular_scroll_view_state_updates_ios")) {
CoreFeatures::enableGranularScrollViewStateUpdatesIOS = true;
}
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,7 @@ public class com/facebook/react/config/ReactFeatureFlags {
public static field enableBridgelessArchitectureNewCreateReloadDestroy Z
public static field enableBridgelessArchitectureSoftExceptions Z
public static field enableClonelessStateProgression Z
public static field enableCppPropsIteratorSetter Z
public static field enableEagerRootViewAttachment Z
public static field enableFabricLogs Z
public static field enableFabricPendingEventQueue Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public class ReactFeatureFlags {
*/
public static boolean enableViewRecycling = false;

/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
public static boolean enableCppPropsIteratorSetter = false;

/**
* Allow Differentiator.cpp and FabricMountingManager.cpp to generate a RemoveDeleteTree mega-op.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<e0feebb19816cd356ba2f28d3bec937a>>
* @generated SignedSource<<c526fb1c44f00f5b032684396246e4d4>>
*/

/**
Expand Down Expand Up @@ -88,12 +88,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun inspectorEnableModernCDPRegistry(): Boolean = accessor.inspectorEnableModernCDPRegistry()

/**
* Specifies whether the iterator-style prop parsing is enabled.
*/
@JvmStatic
public fun enablePropIteratorSetter(): Boolean = accessor.enablePropIteratorSetter()

/**
* Overrides the feature flags with the ones provided by the given provider
* (generally one that extends `ReactNativeFeatureFlagsDefaults`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<144af28ad2eb5bf179ed003da3d76165>>
* @generated SignedSource<<11824621ee7ca5dbdf2f09bdf1a1f983>>
*/

/**
Expand All @@ -30,7 +30,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
private var inspectorEnableCxxInspectorPackagerConnectionCache: Boolean? = null
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
private var enablePropIteratorSetterCache: Boolean? = null

override fun commonTestFlag(): Boolean {
var cached = commonTestFlagCache
Expand Down Expand Up @@ -122,15 +121,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun enablePropIteratorSetter(): Boolean {
var cached = enablePropIteratorSetterCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enablePropIteratorSetter()
enablePropIteratorSetterCache = cached
}
return cached
}

override fun override(provider: ReactNativeFeatureFlagsProvider): Unit =
ReactNativeFeatureFlagsCxxInterop.override(provider as Any)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<da9e28f14db819d8a15d59f311173f8b>>
* @generated SignedSource<<dfbe9bcab657e4c66dd104788639448d>>
*/

/**
Expand Down Expand Up @@ -48,8 +48,6 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun inspectorEnableModernCDPRegistry(): Boolean

@DoNotStrip @JvmStatic public external fun enablePropIteratorSetter(): Boolean

@DoNotStrip @JvmStatic public external fun override(provider: Any)

@DoNotStrip @JvmStatic public external fun dangerouslyReset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f50066bc31b868f2ea202e20753326bd>>
* @generated SignedSource<<cc8e437bf2f486949f256a19d3d73a1e>>
*/

/**
Expand Down Expand Up @@ -42,6 +42,4 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean = false

override fun inspectorEnableModernCDPRegistry(): Boolean = false

override fun enablePropIteratorSetter(): Boolean = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<ac6fa0c879e4748ad503944c9d10b3fd>>
* @generated SignedSource<<63356ad414e641eae11ca07b1a876fd3>>
*/

/**
Expand Down Expand Up @@ -34,7 +34,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
private var inspectorEnableCxxInspectorPackagerConnectionCache: Boolean? = null
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
private var enablePropIteratorSetterCache: Boolean? = null

override fun commonTestFlag(): Boolean {
var cached = commonTestFlagCache
Expand Down Expand Up @@ -136,16 +135,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun enablePropIteratorSetter(): Boolean {
var cached = enablePropIteratorSetterCache
if (cached == null) {
cached = currentProvider.enablePropIteratorSetter()
accessedFeatureFlags.add("enablePropIteratorSetter")
enablePropIteratorSetterCache = cached
}
return cached
}

override fun override(provider: ReactNativeFeatureFlagsProvider) {
if (accessedFeatureFlags.isNotEmpty()) {
val accessedFeatureFlagsStr = accessedFeatureFlags.joinToString(separator = ", ") { it }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<01a82369c1bababe47535b8cceb487eb>>
* @generated SignedSource<<c5388e841a06044520f6c89fcca27286>>
*/

/**
Expand Down Expand Up @@ -42,6 +42,4 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun inspectorEnableCxxInspectorPackagerConnection(): Boolean

@DoNotStrip public fun inspectorEnableModernCDPRegistry(): Boolean

@DoNotStrip public fun enablePropIteratorSetter(): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ void Binding::installFabricUIManager(
"CalculateTransformedFramesEnabled",
getFeatureFlagValue("calculateTransformedFramesEnabled"));

CoreFeatures::enablePropIteratorSetter =
getFeatureFlagValue("enableCppPropsIteratorSetter");
CoreFeatures::enableClonelessStateProgression =
getFeatureFlagValue("enableClonelessStateProgression");
CoreFeatures::excludeYogaFromRawProps =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<faa13422c6380237c6a33f95f79302f2>>
* @generated SignedSource<<f40d52242f2c758ed616f1e5d8c3a082>>
*/

/**
Expand Down Expand Up @@ -99,12 +99,6 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}

bool enablePropIteratorSetter() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enablePropIteratorSetter");
return method(javaProvider_);
}

private:
jni::global_ref<jobject> javaProvider_;
};
Expand Down Expand Up @@ -159,11 +153,6 @@ bool JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry(
return ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry();
}

bool JReactNativeFeatureFlagsCxxInterop::enablePropIteratorSetter(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enablePropIteratorSetter();
}

void JReactNativeFeatureFlagsCxxInterop::override(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/,
jni::alias_ref<jobject> provider) {
Expand Down Expand Up @@ -211,9 +200,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"inspectorEnableModernCDPRegistry",
JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry),
makeNativeMethod(
"enablePropIteratorSetter",
JReactNativeFeatureFlagsCxxInterop::enablePropIteratorSetter),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<70f4f8c1d6f86bcbcb13af782e7356cd>>
* @generated SignedSource<<a860f8ca5806886a2e7b0b9a508482a1>>
*/

/**
Expand Down Expand Up @@ -60,9 +60,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool inspectorEnableModernCDPRegistry(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enablePropIteratorSetter(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static void override(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>,
jni::alias_ref<jobject> provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<bebbf1ec03ad9dfdf59dd566618f69ef>>
* @generated SignedSource<<82f226df2b3824d03b755a042b20bec5>>
*/

/**
Expand Down Expand Up @@ -61,10 +61,6 @@ bool ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry() {
return getAccessor().inspectorEnableModernCDPRegistry();
}

bool ReactNativeFeatureFlags::enablePropIteratorSetter() {
return getAccessor().enablePropIteratorSetter();
}

void ReactNativeFeatureFlags::override(
std::unique_ptr<ReactNativeFeatureFlagsProvider> provider) {
getAccessor().override(std::move(provider));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<98243d4cb18b03d4a2273416879f1081>>
* @generated SignedSource<<3bfae310dfd28040f4b80d1a1df8b7b3>>
*/

/**
Expand Down Expand Up @@ -83,11 +83,6 @@ class ReactNativeFeatureFlags {
*/
static bool inspectorEnableModernCDPRegistry();

/**
* Specifies whether the iterator-style prop parsing is enabled.
*/
static bool enablePropIteratorSetter();

/**
* Overrides the feature flags with the ones provided by the given provider
* (generally one that extends `ReactNativeFeatureFlagsDefaults`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<94d6891851ba8d96e9049e9a4eb727ca>>
* @generated SignedSource<<2154292f89306f25289583537833a065>>
*/

/**
Expand Down Expand Up @@ -209,24 +209,6 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableModernCDPRegistry() {
return flagValue.value();
}

bool ReactNativeFeatureFlagsAccessor::enablePropIteratorSetter() {
auto flagValue = enablePropIteratorSetter_.load();

if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.

markFlagAsAccessed(10, "enablePropIteratorSetter");

flagValue = currentProvider_->enablePropIteratorSetter();
enablePropIteratorSetter_ = flagValue;
}

return flagValue.value();
}

void ReactNativeFeatureFlagsAccessor::override(
std::unique_ptr<ReactNativeFeatureFlagsProvider> provider) {
if (wasOverridden_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<756f3b972dcc9f96e4fd5d0c67e945b6>>
* @generated SignedSource<<95487968b66d40e1ec53936b06084931>>
*/

/**
Expand Down Expand Up @@ -41,7 +41,6 @@ class ReactNativeFeatureFlagsAccessor {
bool enableFixForClippedSubviewsCrash();
bool inspectorEnableCxxInspectorPackagerConnection();
bool inspectorEnableModernCDPRegistry();
bool enablePropIteratorSetter();

void override(std::unique_ptr<ReactNativeFeatureFlagsProvider> provider);

Expand All @@ -52,7 +51,7 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;

std::array<std::atomic<const char*>, 11> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 10> accessedFeatureFlags_;

std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> enableBackgroundExecutor_;
Expand All @@ -64,7 +63,6 @@ class ReactNativeFeatureFlagsAccessor {
std::atomic<std::optional<bool>> enableFixForClippedSubviewsCrash_;
std::atomic<std::optional<bool>> inspectorEnableCxxInspectorPackagerConnection_;
std::atomic<std::optional<bool>> inspectorEnableModernCDPRegistry_;
std::atomic<std::optional<bool>> enablePropIteratorSetter_;
};

} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<22f3908006ed4979a639c7e374e6dc9a>>
* @generated SignedSource<<4832483bb3648380f2bb9312311f579c>>
*/

/**
Expand Down Expand Up @@ -66,10 +66,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
bool inspectorEnableModernCDPRegistry() override {
return false;
}

bool enablePropIteratorSetter() override {
return false;
}
};

} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<37a53122381f8d5c2b953c609963e59b>>
* @generated SignedSource<<f707d15cf978d7342cdf5aab18444219>>
*/

/**
Expand Down Expand Up @@ -35,7 +35,6 @@ class ReactNativeFeatureFlagsProvider {
virtual bool enableFixForClippedSubviewsCrash() = 0;
virtual bool inspectorEnableCxxInspectorPackagerConnection() = 0;
virtual bool inspectorEnableModernCDPRegistry() = 0;
virtual bool enablePropIteratorSetter() = 0;
};

} // namespace facebook::react
Loading

0 comments on commit 093b745

Please sign in to comment.