Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<<82da59cbfb06937bba284ff1df2c64d6>>
* @generated SignedSource<<497133038b4ac4b29ab8d172a82285fc>>
*/

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

/**
* When enabled, Android will accumulate updates in rawProps to reduce the number of mounting instructions for cascading re-renders.
*/
@JvmStatic
public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = accessor.enableAccumulatedUpdatesInRawPropsAndroid()

/**
* Enables various optimizations throughout the path of measuring text on Android.
*/
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<<b6d6b8aae3449760d857e5dd52588b03>>
* @generated SignedSource<<50a1a0eeaef6bb9f8a7f7491bad8f24d>>
*/

/**
Expand All @@ -31,7 +31,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var disableTextLayoutManagerCacheAndroidCache: Boolean? = null
private var disableViewPreallocationAndroidCache: Boolean? = null
private var enableAccessibilityOrderCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
Expand Down Expand Up @@ -212,15 +211,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun enableAndroidTextMeasurementOptimizations(): Boolean {
var cached = enableAndroidTextMeasurementOptimizationsCache
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<<7ca56a7b519e6e1619931447dcc1672a>>
* @generated SignedSource<<f7d31a1306d76e08aa21774c29e6e53d>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): 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<<fe424de3f03b5f2ee20b83896eef01b1>>
* @generated SignedSource<<d4a3d675fe5516c39670052b2de41175>>
*/

/**
Expand Down Expand Up @@ -45,8 +45,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableAccessibilityOrder(): Boolean = false

override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false

override fun enableAndroidTextMeasurementOptimizations(): Boolean = false

override fun enableBridgelessArchitecture(): 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<<0de759cf10c9d77c9938f9dac257aada>>
* @generated SignedSource<<5585df6f3056f8f15ed00e58f521865a>>
*/

/**
Expand Down Expand Up @@ -35,7 +35,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var disableTextLayoutManagerCacheAndroidCache: Boolean? = null
private var disableViewPreallocationAndroidCache: Boolean? = null
private var enableAccessibilityOrderCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
Expand Down Expand Up @@ -227,16 +226,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun enableAndroidTextMeasurementOptimizations(): Boolean {
var cached = enableAndroidTextMeasurementOptimizationsCache
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<<dd7ae1c5f86fa273402e5b64a8636528>>
* @generated SignedSource<<d91e9cbbbb0ab6f2e88b21db315dfa04>>
*/

/**
Expand Down Expand Up @@ -45,8 +45,6 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableAccessibilityOrder(): Boolean

@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean

@DoNotStrip public fun enableAndroidTextMeasurementOptimizations(): Boolean

@DoNotStrip public fun enableBridgelessArchitecture(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,11 @@ jni::local_ref<jobject> getProps(

return ReadableNativeMap::newObjectCxxArgs(std::move(diff));
}
if (ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid()) {
if (oldProps == nullptr) {
return ReadableNativeMap::newObjectCxxArgs(newProps->rawProps);
} else {
return ReadableNativeMap::newObjectCxxArgs(
diffDynamicProps(oldProps->rawProps, newProps->rawProps));
}
if (oldProps == nullptr) {
return ReadableNativeMap::newObjectCxxArgs(newProps->rawProps);
}
return ReadableNativeMap::newObjectCxxArgs(newProps->rawProps);
return ReadableNativeMap::newObjectCxxArgs(
diffDynamicProps(oldProps->rawProps, newProps->rawProps));
}

struct InstructionBuffer {
Expand Down Expand Up @@ -725,28 +721,15 @@ void FabricMountingManager::executeMount(

bool shouldCreateView =
!allocatedViewTags.contains(newChildShadowView.tag);
if (ReactNativeFeatureFlags::
enableAccumulatedUpdatesInRawPropsAndroid()) {
if (shouldCreateView) {
LOG(ERROR) << "Emitting insert for unallocated view "
<< newChildShadowView.tag;
}
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(
CppMountItem::UpdatePropsMountItem(
{}, newChildShadowView));
} else {
if (shouldCreateView) {
LOG(ERROR) << "Emitting insert for unallocated view "
<< newChildShadowView.tag;
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(
CppMountItem::UpdatePropsMountItem(
{}, newChildShadowView));
}
if (shouldCreateView) {
LOG(ERROR) << "Emitting insert for unallocated view "
<< newChildShadowView.tag;
}
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(
CppMountItem::UpdatePropsMountItem(
{}, newChildShadowView));

// State
if (newChildShadowView.state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,35 +620,9 @@ FabricUIManagerBinding::getMountingManager(const char* locationHint) {
}

void FabricUIManagerBinding::schedulerDidFinishTransaction(
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator) {
if (ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid()) {
// We don't do anything here. We will pull the transaction in
// `schedulerShouldRenderTransactions`.
} else {
// We shouldn't be pulling the transaction here (which triggers diffing of
// the trees to determine the mutations to run on the host platform),
// but we have to due to current limitations in the Android implementation.
auto mountingTransaction = mountingCoordinator->pullTransaction(
/* willPerformAsynchronously = */ true);
if (!mountingTransaction.has_value()) {
return;
}

std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
auto pendingTransaction = std::find_if(
pendingTransactions_.begin(),
pendingTransactions_.end(),
[&](const auto& transaction) {
return transaction.getSurfaceId() ==
mountingTransaction->getSurfaceId();
});

if (pendingTransaction != pendingTransactions_.end()) {
pendingTransaction->mergeWith(std::move(*mountingTransaction));
} else {
pendingTransactions_.push_back(std::move(*mountingTransaction));
}
}
const std::shared_ptr<const MountingCoordinator>& /*mountingCoordinator*/) {
// We don't do anything here. We will pull the transaction in
// `schedulerShouldRenderTransactions`.
}

void FabricUIManagerBinding::schedulerShouldRenderTransactions(
Expand All @@ -671,33 +645,11 @@ void FabricUIManagerBinding::schedulerShouldRenderTransactions(
}
}

if (ReactNativeFeatureFlags::enableAccumulatedUpdatesInRawPropsAndroid()) {
auto mountingTransaction = mountingCoordinator->pullTransaction(
/* willPerformAsynchronously = */ true);
if (mountingTransaction.has_value()) {
auto transaction = std::move(*mountingTransaction);
mountingManager->executeMount(transaction);
}
} else {
std::vector<MountingTransaction> pendingTransactions;

{
// Retain the lock to access the pending transactions but not to execute
// the mount operations because that method can call into this method
// again.
//
// This can be re-entrant when mounting manager triggers state updates
// synchronously (this can happen when committing from the UI thread).
// This is safe because we're already combining all the transactions for
// the same surface ID in a single transaction in the pending transactions
// list, so operations won't run out of order.
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
pendingTransactions_.swap(pendingTransactions);
}

for (auto& transaction : pendingTransactions) {
mountingManager->executeMount(transaction);
}
auto mountingTransaction = mountingCoordinator->pullTransaction(
/* willPerformAsynchronously = */ true);
if (mountingTransaction.has_value()) {
auto transaction = std::move(*mountingTransaction);
mountingManager->executeMount(transaction);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ class FabricUIManagerBinding : public jni::HybridClass<FabricUIManagerBinding>,
surfaceHandlerRegistry_{};
std::shared_mutex surfaceHandlerRegistryMutex_; // Protects `surfaceHandlerRegistry_`.

// Track pending transactions, one per surfaceId
std::mutex pendingTransactionsMutex_;
std::vector<MountingTransaction> pendingTransactions_;

float pointScaleFactor_ = 1;

bool enableFabricLogs_{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<<411aef7b1b977407b52e4f23e95db0a5>>
* @generated SignedSource<<4b634360db1cb90223867041ea754fdc>>
*/

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

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

bool enableAndroidTextMeasurementOptimizations() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAndroidTextMeasurementOptimizations");
Expand Down Expand Up @@ -650,11 +644,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder(
return ReactNativeFeatureFlags::enableAccessibilityOrder();
}

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

bool JReactNativeFeatureFlagsCxxInterop::enableAndroidTextMeasurementOptimizations(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableAndroidTextMeasurementOptimizations();
Expand Down Expand Up @@ -1119,9 +1108,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableAccessibilityOrder",
JReactNativeFeatureFlagsCxxInterop::enableAccessibilityOrder),
makeNativeMethod(
"enableAccumulatedUpdatesInRawPropsAndroid",
JReactNativeFeatureFlagsCxxInterop::enableAccumulatedUpdatesInRawPropsAndroid),
makeNativeMethod(
"enableAndroidTextMeasurementOptimizations",
JReactNativeFeatureFlagsCxxInterop::enableAndroidTextMeasurementOptimizations),
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<<7b397abbf52289b37f424eef8e689cc8>>
* @generated SignedSource<<37dbff4b0cd9a8117878a157f4844d15>>
*/

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

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

static bool enableAndroidTextMeasurementOptimizations(
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<<505f532777eb5c18637f61b824600234>>
* @generated SignedSource<<11263b2ce36a89d8bd83e216fb709da6>>
*/

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

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

bool ReactNativeFeatureFlags::enableAndroidTextMeasurementOptimizations() {
return getAccessor().enableAndroidTextMeasurementOptimizations();
}
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<<ec9479d555f4e08095fbde0bfd09c479>>
* @generated SignedSource<<12fbac6785a1f5a3e3aa0f669b18a9d9>>
*/

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

/**
* When enabled, Android will accumulate updates in rawProps to reduce the number of mounting instructions for cascading re-renders.
*/
RN_EXPORT static bool enableAccumulatedUpdatesInRawPropsAndroid();

/**
* Enables various optimizations throughout the path of measuring text on Android.
*/
Expand Down
Loading