Skip to content

Commit

Permalink
Clean up androidEnablePendingFabricTransactions feature flag
Browse files Browse the repository at this point in the history
Summary: We tested this feature flag at Meta and it's neutral when used outside the event loop. We'll handle its effects on the event loop as part of the event loop experiment itself (when enabling paint blocking).

Differential Revision: D57861195
  • Loading branch information
rubennorte authored and facebook-github-bot committed May 28, 2024
1 parent d937883 commit 8d575f1
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 154 deletions.
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<<d6c66f8e1322b8962191fa4af5c8da4b>>
* @generated SignedSource<<84f45a19bf93a62da7ce904a2682fc51>>
*/

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

/**
* To be used with batchRenderingUpdatesInEventLoop. When enbled, the Android mounting layer will concatenate pending transactions to ensure they're applied atomatically
*/
@JvmStatic
public fun androidEnablePendingFabricTransactions(): Boolean = accessor.androidEnablePendingFabricTransactions()

/**
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
*/
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<<53fb9cc52c068dd294507e060d06d75f>>
* @generated SignedSource<<2f84a5455d747e14324f7b79cbbdc763>>
*/

/**
Expand All @@ -22,7 +22,6 @@ package com.facebook.react.internal.featureflags
public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
private var commonTestFlagCache: Boolean? = null
private var allowCollapsableChildrenCache: Boolean? = null
private var androidEnablePendingFabricTransactionsCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
Expand Down Expand Up @@ -60,15 +59,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

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

override fun batchRenderingUpdatesInEventLoop(): Boolean {
var cached = batchRenderingUpdatesInEventLoopCache
if (cached == null) {
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<<8df962abc44ac4368591f34862ccf69e>>
* @generated SignedSource<<c82dca47362f4798dfcebda31b2fe2d6>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun destroyFabricSurfacesInReactInstanceManager(): Boolean
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<<b9067f03d9ae365120f8d6ef607354a6>>
* @generated SignedSource<<1ea3b574063dca0256494361423ce63e>>
*/

/**
Expand All @@ -27,8 +27,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun allowCollapsableChildren(): Boolean = true

override fun androidEnablePendingFabricTransactions(): Boolean = false

override fun batchRenderingUpdatesInEventLoop(): Boolean = false

override fun destroyFabricSurfacesInReactInstanceManager(): Boolean = false
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<<5abf40ebbabb3c0bebead668c1b24ff9>>
* @generated SignedSource<<a66642e4f6027ab0f5280baa2169d901>>
*/

/**
Expand All @@ -26,7 +26,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces

private var commonTestFlagCache: Boolean? = null
private var allowCollapsableChildrenCache: Boolean? = null
private var androidEnablePendingFabricTransactionsCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
Expand Down Expand Up @@ -66,16 +65,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun batchRenderingUpdatesInEventLoop(): Boolean {
var cached = batchRenderingUpdatesInEventLoopCache
if (cached == null) {
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<<0f008837f44348e62dba2a65e813d49e>>
* @generated SignedSource<<7a63b1fc14ccc86efb0929452755744d>>
*/

/**
Expand All @@ -27,8 +27,6 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun allowCollapsableChildren(): Boolean

@DoNotStrip public fun androidEnablePendingFabricTransactions(): Boolean

@DoNotStrip public fun batchRenderingUpdatesInEventLoop(): Boolean

@DoNotStrip public fun destroyFabricSurfacesInReactInstanceManager(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,6 @@ std::shared_ptr<FabricMountingManager> Binding::getMountingManager(

void Binding::schedulerDidFinishTransaction(
const MountingCoordinator::Shared& mountingCoordinator) {
if (!ReactNativeFeatureFlags::androidEnablePendingFabricTransactions()) {
return;
}

auto mountingTransaction = mountingCoordinator->pullTransaction();
if (!mountingTransaction.has_value()) {
return;
Expand Down Expand Up @@ -491,18 +487,11 @@ void Binding::schedulerShouldRenderTransactions(
return;
}

if (ReactNativeFeatureFlags::androidEnablePendingFabricTransactions()) {
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
for (auto& transaction : pendingTransactions_) {
mountingManager->executeMount(transaction);
}
pendingTransactions_.clear();
} else {
auto mountingTransaction = mountingCoordinator->pullTransaction();
if (mountingTransaction.has_value()) {
mountingManager->executeMount(*mountingTransaction);
}
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
for (auto& transaction : pendingTransactions_) {
mountingManager->executeMount(transaction);
}
pendingTransactions_.clear();
}

void Binding::schedulerDidRequestPreliminaryViewAllocation(
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<<4267f2de5ad71437875b03a26ac80d13>>
* @generated SignedSource<<82d20aa409496b17df21a077088894a6>>
*/

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

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

bool batchRenderingUpdatesInEventLoop() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("batchRenderingUpdatesInEventLoop");
Expand Down Expand Up @@ -179,11 +173,6 @@ bool JReactNativeFeatureFlagsCxxInterop::allowCollapsableChildren(
return ReactNativeFeatureFlags::allowCollapsableChildren();
}

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

bool JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
Expand Down Expand Up @@ -297,9 +286,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"allowCollapsableChildren",
JReactNativeFeatureFlagsCxxInterop::allowCollapsableChildren),
makeNativeMethod(
"androidEnablePendingFabricTransactions",
JReactNativeFeatureFlagsCxxInterop::androidEnablePendingFabricTransactions),
makeNativeMethod(
"batchRenderingUpdatesInEventLoop",
JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop),
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<<9d2fdfb02452bcedb14af85488d0b8c7>>
* @generated SignedSource<<08463d4f487df81332c79c8e85b4dac8>>
*/

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

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

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

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<<44c54555ee69104a69d9e60b13ebccbf>>
* @generated SignedSource<<c51ddd57ad10e748d6e2c5f444ea3765>>
*/

/**
Expand All @@ -29,10 +29,6 @@ bool ReactNativeFeatureFlags::allowCollapsableChildren() {
return getAccessor().allowCollapsableChildren();
}

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

bool ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop() {
return getAccessor().batchRenderingUpdatesInEventLoop();
}
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<<8fdad69a7bbf55bdf967292958de6f61>>
* @generated SignedSource<<705dba656bfb228227399bcda638c404>>
*/

/**
Expand Down Expand Up @@ -47,11 +47,6 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool allowCollapsableChildren();

/**
* To be used with batchRenderingUpdatesInEventLoop. When enbled, the Android mounting layer will concatenate pending transactions to ensure they're applied atomatically
*/
RN_EXPORT static bool androidEnablePendingFabricTransactions();

/**
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
*/
Expand Down
Loading

0 comments on commit 8d575f1

Please sign in to comment.