Skip to content

Commit

Permalink
Ship large text measure cache in Fabric Android
Browse files Browse the repository at this point in the history
Summary:
Ship large text measure cache in Fabric Android

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D34602873

fbshipit-source-id: bd0a77b8b2f85301a78d528e7810938b78c7f7b8
  • Loading branch information
mdvacca authored and facebook-github-bot committed Mar 3, 2022
1 parent 8669277 commit 97f3eb2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,10 @@ public static boolean doesUseOverflowInset() {
public static boolean insertZReorderBarriersOnViewGroupChildren = true;

public static boolean enableDelayedViewStateDeletion = false;

/**
* Feature Flag to control the size of the cache used by TextLayoutManager in Fabric. Used from
* JNI.
*/
public static boolean enableLargeTextMeasureCache = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ Binding::getInspectorDataForInstance(
return ReadableNativeMap::newObjectCxxArgs(result);
}

bool isLargeTextMeasureCacheEnabled() {
static const auto reactFeatureFlagsJavaDescriptor =
jni::findClassStatic(Binding::ReactFeatureFlagsJavaDescriptor);
const auto field = reactFeatureFlagsJavaDescriptor->getStaticField<jboolean>(
"enableLargeTextMeasureCache");
return reactFeatureFlagsJavaDescriptor->getStaticFieldValue(field);
}

bool isMapBufferSerializationEnabled() {
static const auto reactFeatureFlagsJavaDescriptor =
jni::findClassStatic(Binding::ReactFeatureFlagsJavaDescriptor);
Expand Down Expand Up @@ -437,9 +445,7 @@ void Binding::installFabricUIManager(
"react_native_new_architecture:dispatch_preallocation_in_bg");

contextContainer->insert(
"EnableLargeTextMeasureCache",
reactNativeConfig_->getBool(
"react_fabric:enable_large_text_measure_cache_android"));
"EnableLargeTextMeasureCache", isLargeTextMeasureCacheEnabled());

auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
Expand Down

0 comments on commit 97f3eb2

Please sign in to comment.