Add batched animated prop update path on Android (#56468)#56468
Add batched animated prop update path on Android (#56468)#56468bartlomiejbloniarz wants to merge 2 commits into
Conversation
|
@bartlomiejbloniarz has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101157453. |
Summary: Introduces the cross-platform delegate chain for batched animated property updates without any platform implementation: - Adds `schedulerShouldSynchronouslyUpdateAnimatedPropsOnUIThread` to `SchedulerDelegate` and forwards from `Scheduler`. - Adds `uiManagerShouldSynchronouslyUpdateAnimatedPropsOnUIThread` to `UIManagerDelegate` and `synchronouslyUpdateAnimatedPropsOnUIThread` to `UIManager`. - Adds no-op stubs in iOS (`RCTScheduler.mm`), macOS (`RCTScheduler.mm`), Windows (`FabricUIManagerModule`) and CxxPlatform (`SchedulerDelegateImpl`). No behavioural impact; Android implementation lands in a follow-up. Changelog: [Internal] Differential Revision: D104672455
9822880 to
a6bf42a
Compare
a6bf42a to
a16e381
Compare
Summary: Pull Request resolved: #56468 Implements the Android batched animated prop update path on top of the cross-platform delegate chain introduced in the previous commit. Gated behind the `optimizedAnimatedPropUpdates` feature flag, so this change has no behavioural impact when the flag is off. - `BatchedAnimatedPropsMountItem.kt`: decodes the int/double buffer protocol and applies updates to views. - `AnimatedPropBufferEncoder` + `AnimatedPropCommands`: C++ side that encodes `AnimatedProps` into the buffer protocol. - `FabricMountingManager::synchronouslyUpdateAnimatedPropsOnUIThread`: builds the buffers and JNI-calls into Java. - `FabricUIManagerBinding`: wires the `SchedulerDelegate` override into `FabricMountingManager`. - `FabricUIManager.synchronouslyUpdateViewBatch`: Java entry point invoked from JNI that constructs and executes a `BatchedAnimatedPropsMountItem`. Changelog: [Android][Added] - Add a batched animated prop update path that applies all pending C++ animation backend updates via a single mount item (gated by `optimizedAnimatedPropUpdates`) Differential Revision: D101157453
a16e381 to
b7548e8
Compare
|
This pull request was successfully merged by Bartlomiej Bloniarz in b7548e8 When will my fix make it into a release? | How to file a pick request? |
|
This pull request was successfully merged by Bartlomiej Bloniarz in 07137c2 When will my fix make it into a release? | How to file a pick request? |
| } | ||
|
|
||
| when (cmd) { | ||
| in CMD_OPACITY..CMD_SHADOW_RADIUS -> |
There was a problem hiding this comment.
How about listing all enum values explicitly instead of using ..? The current version is very prone to breaking when we introduce new props or change the underlying enum values
| static constexpr int CMD_BORDER_START_COLOR = 45; | ||
| static constexpr int CMD_BORDER_END_COLOR = 46; | ||
|
|
||
| // Transform commands |
There was a problem hiding this comment.
Do we also want to add support for transformOrigin?
| } | ||
| } | ||
|
|
||
| override fun toString(): String { |
There was a problem hiding this comment.
I don't like it that this logic is duplicated
| CMD_BORDER_RIGHT_COLOR -> ViewProps.BORDER_RIGHT_COLOR | ||
| CMD_BORDER_START_COLOR -> ViewProps.BORDER_START_COLOR | ||
| CMD_BORDER_END_COLOR -> ViewProps.BORDER_END_COLOR | ||
| else -> "unknown" |
| CMD_SKEW_Y -> "skewY" | ||
| CMD_MATRIX -> "matrix" | ||
| CMD_PERSPECTIVE -> "perspective" | ||
| else -> "unknown" |
| CMD_SCALE_X -> ViewProps.SCALE_X | ||
| CMD_SCALE_Y -> ViewProps.SCALE_Y | ||
| CMD_ROTATE -> "rotate" | ||
| CMD_ROTATE_X -> "rotateX" |
There was a problem hiding this comment.
Why do we sometimes use ViewProps.* and sometimes string literal?
Summary:
Implements the Android batched animated prop update path on top of the cross-platform delegate chain introduced in the previous commit. Gated behind the
optimizedAnimatedPropUpdatesfeature flag, so this change has no behavioural impact when the flag is off.BatchedAnimatedPropsMountItem.kt: decodes the int/double buffer protocol and applies updates to views.AnimatedPropBufferEncoder+AnimatedPropCommands: C++ side that encodesAnimatedPropsinto the buffer protocol.FabricMountingManager::synchronouslyUpdateAnimatedPropsOnUIThread: builds the buffers and JNI-calls into Java.FabricUIManagerBinding: wires theSchedulerDelegateoverride intoFabricMountingManager.FabricUIManager.synchronouslyUpdateViewBatch: Java entry point invoked from JNI that constructs and executes aBatchedAnimatedPropsMountItem.Changelog:
[Android][Added] - Add a batched animated prop update path that applies all pending C++ animation backend updates via a single mount item (gated by
optimizedAnimatedPropUpdates)Differential Revision: D101157453