Migrate CoreFeatures::enableReportEventPaintTime to new feature flags system (#45585)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45585

Changelog: [internal]

Just migrates the flag to the new system.

Reviewed By: sammy-SC

Differential Revision: D60050005

fbshipit-source-id: 4da39446ecdb6cd86ccf7ee75a0d489764c37be6
This commit is contained in:
Rubén Norte
2024-07-23 14:23:03 -07:00
committed by Facebook GitHub Bot
parent bb23026daf
commit 4caf9ec7a0
24 changed files with 148 additions and 52 deletions
@@ -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<<4a2baeeff0b03f07a259028cf4446455>>
* @generated SignedSource<<ca939ab47fa68fbb5acf5ea34481def9>>
*/
/**
@@ -112,6 +112,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enablePropsUpdateReconciliationAndroid(): Boolean = accessor.enablePropsUpdateReconciliationAndroid()
/**
* Report paint time inside the Event Timing API implementation (PerformanceObserver).
*/
@JvmStatic
public fun enableReportEventPaintTime(): Boolean = accessor.enableReportEventPaintTime()
/**
* Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).
*/
@@ -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<<7fbe53bfb2b06cdae8b1590c9131edbb>>
* @generated SignedSource<<2a8d5ca8a0ac46b4d3177cb8b12ad7ac>>
*/
/**
@@ -34,6 +34,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var enableLongTaskAPICache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
private var enableReportEventPaintTimeCache: Boolean? = null
private var enableSynchronousStateUpdatesCache: Boolean? = null
private var enableUIConsistencyCache: Boolean? = null
private var excludeYogaFromRawPropsCache: Boolean? = null
@@ -183,6 +184,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableReportEventPaintTime(): Boolean {
var cached = enableReportEventPaintTimeCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableReportEventPaintTime()
enableReportEventPaintTimeCache = cached
}
return cached
}
override fun enableSynchronousStateUpdates(): Boolean {
var cached = enableSynchronousStateUpdatesCache
if (cached == null) {
@@ -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<<df4c04351e9713db7de1ecf4d8f8d435>>
* @generated SignedSource<<aaf205098eaac9171aa15bc8f7bda805>>
*/
/**
@@ -56,6 +56,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enablePropsUpdateReconciliationAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun enableReportEventPaintTime(): Boolean
@DoNotStrip @JvmStatic public external fun enableSynchronousStateUpdates(): Boolean
@DoNotStrip @JvmStatic public external fun enableUIConsistency(): Boolean
@@ -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<<fcab38c9de5314e55ff64584b9221b9c>>
* @generated SignedSource<<abdee8d0b85b0d9940207b9cbe6d3f78>>
*/
/**
@@ -51,6 +51,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enablePropsUpdateReconciliationAndroid(): Boolean = false
override fun enableReportEventPaintTime(): Boolean = false
override fun enableSynchronousStateUpdates(): Boolean = false
override fun enableUIConsistency(): Boolean = false
@@ -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<<c740d546d8154130aeabdd3667c26473>>
* @generated SignedSource<<82f6d4eda4011bee81810af366f5d677>>
*/
/**
@@ -38,6 +38,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var enableLongTaskAPICache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
private var enableReportEventPaintTimeCache: Boolean? = null
private var enableSynchronousStateUpdatesCache: Boolean? = null
private var enableUIConsistencyCache: Boolean? = null
private var excludeYogaFromRawPropsCache: Boolean? = null
@@ -201,6 +202,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableReportEventPaintTime(): Boolean {
var cached = enableReportEventPaintTimeCache
if (cached == null) {
cached = currentProvider.enableReportEventPaintTime()
accessedFeatureFlags.add("enableReportEventPaintTime")
enableReportEventPaintTimeCache = cached
}
return cached
}
override fun enableSynchronousStateUpdates(): Boolean {
var cached = enableSynchronousStateUpdatesCache
if (cached == null) {
@@ -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<<c3138a9a6b90f5a35bcdda2928b759ed>>
* @generated SignedSource<<ece587d5e6643fb906cfee816824f224>>
*/
/**
@@ -51,6 +51,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enablePropsUpdateReconciliationAndroid(): Boolean
@DoNotStrip public fun enableReportEventPaintTime(): Boolean
@DoNotStrip public fun enableSynchronousStateUpdates(): Boolean
@DoNotStrip public fun enableUIConsistency(): Boolean
@@ -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<<7671fb85b168f4eb8713fe087a9f1e31>>
* @generated SignedSource<<7c14f956fd20226acfb532d806c6eb7a>>
*/
/**
@@ -123,6 +123,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableReportEventPaintTime() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableReportEventPaintTime");
return method(javaProvider_);
}
bool enableSynchronousStateUpdates() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableSynchronousStateUpdates");
@@ -329,6 +335,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enablePropsUpdateReconciliationAndroid(
return ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::enableReportEventPaintTime(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableReportEventPaintTime();
}
bool JReactNativeFeatureFlagsCxxInterop::enableSynchronousStateUpdates(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableSynchronousStateUpdates();
@@ -498,6 +509,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enablePropsUpdateReconciliationAndroid",
JReactNativeFeatureFlagsCxxInterop::enablePropsUpdateReconciliationAndroid),
makeNativeMethod(
"enableReportEventPaintTime",
JReactNativeFeatureFlagsCxxInterop::enableReportEventPaintTime),
makeNativeMethod(
"enableSynchronousStateUpdates",
JReactNativeFeatureFlagsCxxInterop::enableSynchronousStateUpdates),
@@ -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<<06b35c2faaf073589042046179aaf65a>>
* @generated SignedSource<<f06779455d65f78f561eaca745262a99>>
*/
/**
@@ -72,6 +72,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enablePropsUpdateReconciliationAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableReportEventPaintTime(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableSynchronousStateUpdates(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<541ad52f8b28ce4f72da4ce00cc7ba0e>>
* @generated SignedSource<<bab53ba585938b3bf458dbe0874931f8>>
*/
/**
@@ -77,6 +77,10 @@ bool ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid() {
return getAccessor().enablePropsUpdateReconciliationAndroid();
}
bool ReactNativeFeatureFlags::enableReportEventPaintTime() {
return getAccessor().enableReportEventPaintTime();
}
bool ReactNativeFeatureFlags::enableSynchronousStateUpdates() {
return getAccessor().enableSynchronousStateUpdates();
}
@@ -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<<8d5e69e5a5bab6f48008f2b68f1a3126>>
* @generated SignedSource<<55d6c0f7ab8abe8411194235ab362cd2>>
*/
/**
@@ -107,6 +107,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enablePropsUpdateReconciliationAndroid();
/**
* Report paint time inside the Event Timing API implementation (PerformanceObserver).
*/
RN_EXPORT static bool enableReportEventPaintTime();
/**
* Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).
*/
@@ -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<<3ff5c0e239af49ce69f2655e7c2ee937>>
* @generated SignedSource<<b1d1358f4e01ac76eefdbd91610c0c54>>
*/
/**
@@ -281,6 +281,24 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableReportEventPaintTime() {
auto flagValue = enableReportEventPaintTime_.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(14, "enableReportEventPaintTime");
flagValue = currentProvider_->enableReportEventPaintTime();
enableReportEventPaintTime_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
auto flagValue = enableSynchronousStateUpdates_.load();
@@ -290,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(14, "enableSynchronousStateUpdates");
markFlagAsAccessed(15, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -308,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(15, "enableUIConsistency");
markFlagAsAccessed(16, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -326,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(16, "excludeYogaFromRawProps");
markFlagAsAccessed(17, "excludeYogaFromRawProps");
flagValue = currentProvider_->excludeYogaFromRawProps();
excludeYogaFromRawProps_ = flagValue;
@@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::fetchImagesInViewPreallocation() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(17, "fetchImagesInViewPreallocation");
markFlagAsAccessed(18, "fetchImagesInViewPreallocation");
flagValue = currentProvider_->fetchImagesInViewPreallocation();
fetchImagesInViewPreallocation_ = flagValue;
@@ -362,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::fixIncorrectScrollViewStateUpdateOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(18, "fixIncorrectScrollViewStateUpdateOnAndroid");
markFlagAsAccessed(19, "fixIncorrectScrollViewStateUpdateOnAndroid");
flagValue = currentProvider_->fixIncorrectScrollViewStateUpdateOnAndroid();
fixIncorrectScrollViewStateUpdateOnAndroid_ = flagValue;
@@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(19, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(20, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMissedFabricStateUpdatesOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(20, "fixMissedFabricStateUpdatesOnAndroid");
markFlagAsAccessed(21, "fixMissedFabricStateUpdatesOnAndroid");
flagValue = currentProvider_->fixMissedFabricStateUpdatesOnAndroid();
fixMissedFabricStateUpdatesOnAndroid_ = flagValue;
@@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(21, "forceBatchingMountItemsOnAndroid");
markFlagAsAccessed(22, "forceBatchingMountItemsOnAndroid");
flagValue = currentProvider_->forceBatchingMountItemsOnAndroid();
forceBatchingMountItemsOnAndroid_ = flagValue;
@@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(22, "fuseboxEnabledDebug");
markFlagAsAccessed(23, "fuseboxEnabledDebug");
flagValue = currentProvider_->fuseboxEnabledDebug();
fuseboxEnabledDebug_ = flagValue;
@@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(23, "fuseboxEnabledRelease");
markFlagAsAccessed(24, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(24, "initEagerTurboModulesOnNativeModulesQueueAndroid");
markFlagAsAccessed(25, "initEagerTurboModulesOnNativeModulesQueueAndroid");
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
@@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(25, "lazyAnimationCallbacks");
markFlagAsAccessed(26, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(26, "loadVectorDrawablesOnImages");
markFlagAsAccessed(27, "loadVectorDrawablesOnImages");
flagValue = currentProvider_->loadVectorDrawablesOnImages();
loadVectorDrawablesOnImages_ = flagValue;
@@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(27, "setAndroidLayoutDirection");
markFlagAsAccessed(28, "setAndroidLayoutDirection");
flagValue = currentProvider_->setAndroidLayoutDirection();
setAndroidLayoutDirection_ = flagValue;
@@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless()
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(28, "useImmediateExecutorInAndroidBridgeless");
markFlagAsAccessed(29, "useImmediateExecutorInAndroidBridgeless");
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
useImmediateExecutorInAndroidBridgeless_ = flagValue;
@@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "useModernRuntimeScheduler");
markFlagAsAccessed(30, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
@@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(30, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(31, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::useNewReactImageViewBackgroundDrawing() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(31, "useNewReactImageViewBackgroundDrawing");
markFlagAsAccessed(32, "useNewReactImageViewBackgroundDrawing");
flagValue = currentProvider_->useNewReactImageViewBackgroundDrawing();
useNewReactImageViewBackgroundDrawing_ = flagValue;
@@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(32, "useOptimisedViewPreallocationOnAndroid");
markFlagAsAccessed(33, "useOptimisedViewPreallocationOnAndroid");
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
useOptimisedViewPreallocationOnAndroid_ = flagValue;
@@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(33, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(34, "useRuntimeShadowNodeReferenceUpdate");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
@@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayou
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(34, "useRuntimeShadowNodeReferenceUpdateOnLayout");
markFlagAsAccessed(35, "useRuntimeShadowNodeReferenceUpdateOnLayout");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout();
useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue;
@@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(35, "useStateAlignmentMechanism");
markFlagAsAccessed(36, "useStateAlignmentMechanism");
flagValue = currentProvider_->useStateAlignmentMechanism();
useStateAlignmentMechanism_ = flagValue;
@@ -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<<8efbce21aeb4cd838f324264514b3e68>>
* @generated SignedSource<<c1230df8d1603fb6738dd634ab041a02>>
*/
/**
@@ -45,6 +45,7 @@ class ReactNativeFeatureFlagsAccessor {
bool enableLongTaskAPI();
bool enableMicrotasks();
bool enablePropsUpdateReconciliationAndroid();
bool enableReportEventPaintTime();
bool enableSynchronousStateUpdates();
bool enableUIConsistency();
bool excludeYogaFromRawProps();
@@ -77,7 +78,7 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 36> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 37> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> allowCollapsableChildren_;
@@ -93,6 +94,7 @@ class ReactNativeFeatureFlagsAccessor {
std::atomic<std::optional<bool>> enableLongTaskAPI_;
std::atomic<std::optional<bool>> enableMicrotasks_;
std::atomic<std::optional<bool>> enablePropsUpdateReconciliationAndroid_;
std::atomic<std::optional<bool>> enableReportEventPaintTime_;
std::atomic<std::optional<bool>> enableSynchronousStateUpdates_;
std::atomic<std::optional<bool>> enableUIConsistency_;
std::atomic<std::optional<bool>> excludeYogaFromRawProps_;
@@ -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<<f81d116e79fc7397ddc767ee3e458bd6>>
* @generated SignedSource<<436dd66c962b5bd70cc574d573ddfc0a>>
*/
/**
@@ -83,6 +83,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool enableReportEventPaintTime() override {
return false;
}
bool enableSynchronousStateUpdates() override {
return false;
}
@@ -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<<f9704adc8c8a4db6fac8ae0bcc551ab0>>
* @generated SignedSource<<48be14c9be6da39c4acbf449d9ec8741>>
*/
/**
@@ -39,6 +39,7 @@ class ReactNativeFeatureFlagsProvider {
virtual bool enableLongTaskAPI() = 0;
virtual bool enableMicrotasks() = 0;
virtual bool enablePropsUpdateReconciliationAndroid() = 0;
virtual bool enableReportEventPaintTime() = 0;
virtual bool enableSynchronousStateUpdates() = 0;
virtual bool enableUIConsistency() = 0;
virtual bool excludeYogaFromRawProps() = 0;
@@ -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<<f824b1ee49adf7a82fd2821b7ac0d140>>
* @generated SignedSource<<c3317cfbf03b60568e509dccc4cdacde>>
*/
/**
@@ -107,6 +107,11 @@ bool NativeReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid(
return ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid();
}
bool NativeReactNativeFeatureFlags::enableReportEventPaintTime(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableReportEventPaintTime();
}
bool NativeReactNativeFeatureFlags::enableSynchronousStateUpdates(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableSynchronousStateUpdates();
@@ -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<<a8dd4b26b34c797efe9e2c2f9959f7b3>>
* @generated SignedSource<<e79765ccb9d4b2d46c428b09d65ac12c>>
*/
/**
@@ -63,6 +63,8 @@ class NativeReactNativeFeatureFlags
bool enablePropsUpdateReconciliationAndroid(jsi::Runtime& runtime);
bool enableReportEventPaintTime(jsi::Runtime& runtime);
bool enableSynchronousStateUpdates(jsi::Runtime& runtime);
bool enableUIConsistency(jsi::Runtime& runtime);
@@ -21,5 +21,6 @@ target_include_directories(react_render_observers_events PUBLIC ${REACT_COMMON_D
target_link_libraries(react_render_observers_events
react_performance_timeline
react_render_core
react_featureflags
react_render_uimanager
react_utils)
@@ -7,6 +7,7 @@
#include "EventPerformanceLogger.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/utils/CoreFeatures.h>
#include <unordered_map>
@@ -140,7 +141,7 @@ void EventPerformanceLogger::onEventProcessingEnd(EventTag tag) {
auto& entry = it->second;
entry.processingEndTime = timeStamp;
if (CoreFeatures::enableReportEventPaintTime) {
if (ReactNativeFeatureFlags::enableReportEventPaintTime()) {
// If reporting paint time, don't send the entry just yet and wait for the
// mount hook callback to be called
return;
@@ -162,7 +163,7 @@ void EventPerformanceLogger::onEventProcessingEnd(EventTag tag) {
void EventPerformanceLogger::shadowTreeDidMount(
const RootShadowNode::Shared& /*rootShadowNode*/,
double mountTime) noexcept {
if (!CoreFeatures::enableReportEventPaintTime) {
if (!ReactNativeFeatureFlags::enableReportEventPaintTime()) {
return;
}
@@ -151,10 +151,7 @@ Scheduler::Scheduler(
"react_fabric:remove_outstanding_surfaces_on_destruction_ios");
#endif
CoreFeatures::enableReportEventPaintTime = reactNativeConfig_->getBool(
"rn_responsiveness_performance:enable_paint_time_reporting");
if (CoreFeatures::enableReportEventPaintTime) {
if (ReactNativeFeatureFlags::enableReportEventPaintTime()) {
uiManager->registerMountHook(*eventPerformanceLogger_);
}
}
@@ -12,6 +12,5 @@ namespace facebook::react {
bool CoreFeatures::enablePropIteratorSetter = false;
bool CoreFeatures::enableGranularScrollViewStateUpdatesIOS = false;
bool CoreFeatures::excludeYogaFromRawProps = false;
bool CoreFeatures::enableReportEventPaintTime = false;
} // namespace facebook::react
@@ -25,10 +25,6 @@ class CoreFeatures {
// When enabled, rawProps in Props will not include Yoga specific props.
static bool excludeYogaFromRawProps;
// Report paint time inside the Event Timing API implementation
// (PerformanceObserver).
static bool enableReportEventPaintTime;
};
} // namespace facebook::react
@@ -103,6 +103,11 @@ const definitions: FeatureFlagDefinitions = {
description:
'When enabled, Android will receive prop updates based on the differences between the last rendered shadow node and the last committed shadow node.',
},
enableReportEventPaintTime: {
defaultValue: false,
description:
'Report paint time inside the Event Timing API implementation (PerformanceObserver).',
},
enableSynchronousStateUpdates: {
defaultValue: false,
description:
@@ -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<<1f55fc80f2d20514a341988b4f938ac5>>
* @generated SignedSource<<f734c5d2afd065af224c5051ac3e737f>>
* @flow strict-local
*/
@@ -57,6 +57,7 @@ export type ReactNativeFeatureFlags = {
enableLongTaskAPI: Getter<boolean>,
enableMicrotasks: Getter<boolean>,
enablePropsUpdateReconciliationAndroid: Getter<boolean>,
enableReportEventPaintTime: Getter<boolean>,
enableSynchronousStateUpdates: Getter<boolean>,
enableUIConsistency: Getter<boolean>,
excludeYogaFromRawProps: Getter<boolean>,
@@ -192,6 +193,10 @@ export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableM
* When enabled, Android will receive prop updates based on the differences between the last rendered shadow node and the last committed shadow node.
*/
export const enablePropsUpdateReconciliationAndroid: Getter<boolean> = createNativeFlagGetter('enablePropsUpdateReconciliationAndroid', false);
/**
* Report paint time inside the Event Timing API implementation (PerformanceObserver).
*/
export const enableReportEventPaintTime: Getter<boolean> = createNativeFlagGetter('enableReportEventPaintTime', false);
/**
* Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).
*/
@@ -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<<0ee6343505e52cde7930a31ab5c8218a>>
* @generated SignedSource<<b190bdb77d71a851ab40661eedccac05>>
* @flow strict-local
*/
@@ -37,6 +37,7 @@ export interface Spec extends TurboModule {
+enableLongTaskAPI?: () => boolean;
+enableMicrotasks?: () => boolean;
+enablePropsUpdateReconciliationAndroid?: () => boolean;
+enableReportEventPaintTime?: () => boolean;
+enableSynchronousStateUpdates?: () => boolean;
+enableUIConsistency?: () => boolean;
+excludeYogaFromRawProps?: () => boolean;