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; public static boolean insertZReorderBarriersOnViewGroupChildren = true;
/** Feature Flag for mitigatin concurrent root crashes */
public static boolean enableDelayedViewStateDeletion = false; 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 * Feature Flag to control the size of the cache used by TextLayoutManager in Fabric. Used from
* JNI. * JNI.

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

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

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

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