mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Default to AsynchronousBatched priority (#39011)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39011 Changelog: [internal] Reviewed By: sammy-SC Differential Revision: D48210134 fbshipit-source-id: aac2aec11c35dd6a47bc8fd4bf74f2fa00ab3d7e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a99c9764aa
commit
8cfd80f52c
+3
@@ -160,4 +160,7 @@ public class ReactFeatureFlags {
|
||||
|
||||
/** Clean yoga node when <Text /> does not change. */
|
||||
public static boolean enableCleanParagraphYogaNode = false;
|
||||
|
||||
/** Default state updates and events to async batched priority. */
|
||||
public static boolean enableDefaultAsyncBatchedPriority = false;
|
||||
}
|
||||
|
||||
@@ -435,6 +435,8 @@ void Binding::installFabricUIManager(
|
||||
getFeatureFlagValue("doNotSwapLeftAndRightOnAndroidInLTR");
|
||||
CoreFeatures::enableCleanParagraphYogaNode =
|
||||
getFeatureFlagValue("enableCleanParagraphYogaNode");
|
||||
CoreFeatures::enableDefaultAsyncBatchedPriority =
|
||||
getFeatureFlagValue("enableDefaultAsyncBatchedPriority");
|
||||
|
||||
// RemoveDelete mega-op
|
||||
ShadowViewMutation::PlatformSupportsRemoveDeleteTreeInstruction =
|
||||
|
||||
+4
-1
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "BaseViewEventEmitter.h"
|
||||
#include <react/utils/CoreFeatures.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
@@ -112,7 +113,9 @@ void BaseViewEventEmitter::onLayout(const LayoutMetrics &layoutMetrics) const {
|
||||
payload.setProperty(runtime, "layout", std::move(layout));
|
||||
return jsi::Value(std::move(payload));
|
||||
},
|
||||
EventPriority::AsynchronousUnbatched);
|
||||
CoreFeatures::enableDefaultAsyncBatchedPriority
|
||||
? EventPriority::AsynchronousBatched
|
||||
: EventPriority::AsynchronousUnbatched);
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/core/State.h>
|
||||
#include <react/utils/CoreFeatures.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
@@ -58,9 +59,7 @@ class ConcreteState : public State {
|
||||
* function for cases where a new value of data does not depend on an old
|
||||
* value.
|
||||
*/
|
||||
void updateState(
|
||||
Data &&newData,
|
||||
EventPriority priority = EventPriority::AsynchronousUnbatched) const {
|
||||
void updateState(Data &&newData, EventPriority priority) const {
|
||||
updateState(
|
||||
[data{std::move(newData)}](Data const &oldData) -> SharedData {
|
||||
return std::make_shared<Data const>(data);
|
||||
@@ -68,6 +67,14 @@ class ConcreteState : public State {
|
||||
priority);
|
||||
}
|
||||
|
||||
void updateState(Data &&newData) const {
|
||||
updateState(
|
||||
std::move(newData),
|
||||
CoreFeatures::enableDefaultAsyncBatchedPriority
|
||||
? EventPriority::AsynchronousBatched
|
||||
: EventPriority::AsynchronousUnbatched);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initiate a state update process with a given function (that transforms an
|
||||
* old data value to a new one) and priority. The callback function can be
|
||||
|
||||
@@ -21,5 +21,6 @@ bool CoreFeatures::doNotSwapLeftAndRightOnAndroidInLTR = false;
|
||||
bool CoreFeatures::enableCleanParagraphYogaNode = false;
|
||||
bool CoreFeatures::disableScrollEventThrottleRequirement = false;
|
||||
bool CoreFeatures::enableGranularShadowTreeStateReconciliation = false;
|
||||
bool CoreFeatures::enableDefaultAsyncBatchedPriority = false;
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -64,6 +64,9 @@ class CoreFeatures {
|
||||
// When enabled, the renderer would only fail commits when they propagate
|
||||
// state and the last commit that updated state changed before committing.
|
||||
static bool enableGranularShadowTreeStateReconciliation;
|
||||
|
||||
// Default state updates and events to async batched priority.
|
||||
static bool enableDefaultAsyncBatchedPriority;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
Reference in New Issue
Block a user