Disable preallocation for panel apps

Summary: Disable preallocation for panel apps to mitigate some crashes.

Reviewed By: javache

Differential Revision: D35866301

fbshipit-source-id: e6277e6be7a86682867c6a7ecfe60f7cf1ab549d
This commit is contained in:
Xin Chen 2022-05-03 14:47:47 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 16f30fc0ec
Коммит 72c1a770fe
3 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -94,8 +94,12 @@ public class ReactFeatureFlags {
public static boolean insertZReorderBarriersOnViewGroupChildren = true;
/** Feature Flag for mitigatin concurrent root crashes */
public static boolean enableDelayedViewStateDeletion = false;
public static boolean disablePreallocationOnClone = false;
public static boolean shouldRememberAllocatedViews = false;
/**
* Feature Flag to control the size of the cache used by TextLayoutManager in Fabric. Used from
* JNI.

Просмотреть файл

@ -76,11 +76,11 @@ Binding::getInspectorDataForInstance(
return ReadableNativeMap::newObjectCxxArgs(result);
}
bool isLargeTextMeasureCacheEnabled() {
bool getFeatureFlagValue(const char *name) {
static const auto reactFeatureFlagsJavaDescriptor =
jni::findClassStatic(Binding::ReactFeatureFlagsJavaDescriptor);
const auto field = reactFeatureFlagsJavaDescriptor->getStaticField<jboolean>(
"enableLargeTextMeasureCache");
const auto field =
reactFeatureFlagsJavaDescriptor->getStaticField<jboolean>(name);
return reactFeatureFlagsJavaDescriptor->getStaticFieldValue(field);
}
@ -375,8 +375,8 @@ void Binding::installFabricUIManager(
disableRevisionCheckForPreallocation_ =
config->getBool("react_fabric:disable_revision_check_for_preallocation");
disablePreallocationOnClone_ = config->getBool(
"react_native_new_architecture:disable_preallocation_on_clone_android");
disablePreallocationOnClone_ =
getFeatureFlagValue("disablePreallocationOnClone");
if (enableFabricLogs_) {
LOG(WARNING) << "Binding::installFabricUIManager() was called (address: "
@ -445,7 +445,8 @@ void Binding::installFabricUIManager(
"react_native_new_architecture:dispatch_preallocation_in_bg");
contextContainer->insert(
"EnableLargeTextMeasureCache", isLargeTextMeasureCacheEnabled());
"EnableLargeTextMeasureCache",
getFeatureFlagValue("enableLargeTextMeasureCache"));
auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;

Просмотреть файл

@ -28,11 +28,11 @@ using namespace facebook::jni;
namespace facebook {
namespace react {
static bool doesUseOverflowInset() {
static bool getFeatureFlagValue(const char *name) {
static const auto reactFeatureFlagsJavaDescriptor = jni::findClassStatic(
FabricMountingManager::ReactFeatureFlagsJavaDescriptor);
const auto field = reactFeatureFlagsJavaDescriptor->getStaticField<jboolean>(
"useOverflowInset");
const auto field =
reactFeatureFlagsJavaDescriptor->getStaticField<jboolean>(name);
return reactFeatureFlagsJavaDescriptor->getStaticFieldValue(field);
}
@ -46,9 +46,9 @@ FabricMountingManager::FabricMountingManager(
config->getBool("react_fabric:disabled_view_preallocation_android")),
disableRevisionCheckForPreallocation_(config->getBool(
"react_fabric:disable_revision_check_for_preallocation")),
useOverflowInset_(doesUseOverflowInset()),
shouldRememberAllocatedViews_(config->getBool(
"react_native_new_architecture:remember_views_on_mount_android")),
useOverflowInset_(getFeatureFlagValue("useOverflowInset")),
shouldRememberAllocatedViews_(
getFeatureFlagValue("shouldRememberAllocatedViews")),
useMapBufferForViewProps_(config->getBool(
"react_native_new_architecture:use_mapbuffer_for_viewprops")) {}