Commit Graph

14 Commits

Author SHA1 Message Date
Joshua Gross 09b9422516 Pass context through to all prop parser (core changes)
Summary:
Unfortunately, parsing some props requires stateful context - namely, PlatformColor on Android. We explored several different options but they all seemed inferior to the approach of using ContextContainer, and most would require using global state.

By introducing this change everywhere as early as possible, we can avoid later pain. It is likely that some prop, on some platform, will require this mechanism. We'll be ready for it!

Because we can pass a constref of the ContextContainer through to all props and because the context and context data is never retained by prop parsers, perf and memory hit should be ~0.

This diff contains core changes only. Leaf changes to all props structs and conversions files will be in next diff(s).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29838789

fbshipit-source-id: f5090e7f02eb6e8fbe0ef4dd201e7d12104a3e3c
2021-07-28 20:18:20 -07:00
Joshua Gross 24d91268b6 Add systrace sections to core
Summary:
I'm hunting down the source of a perf regression on a screen and think that having these systrace sections could be handy for this and future investigations.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D29802969

fbshipit-source-id: f4030261da8888ddeb32ae41b9cf2b25af6a5583
2021-07-20 19:28:06 -07:00
Joshua Gross 7d1d4dc064 Ship new C++ Differ in code
Summary:
The new C++ Differ has been validated on Android and iOS. Delete the old code path.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28904330

fbshipit-source-id: 2e0d8682f6b2a79f9758ed8b7b92809060835815
2021-06-07 17:11:55 -07:00
Joshua Gross 39b8233c93 Copy Differ implementation to new file, feature-flag-gate new differ
Summary:
Changes in following diffs will be gated by this feature flag.

The differ in the new file is copied from the current stable implementation and will not be modified until it's deleted.

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D27775698

fbshipit-source-id: 03d9518ffd2b1f25712386c56a38bd2b4d839fc2
2021-04-14 19:50:09 -07:00
David Vacca bdb9a1e094 Add displayMode parameter into startSurface and setSurfaceProps methods
Summary:
This diff extends startSurface and setSurfaceProps methods with the new parameter called displayMode

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D27669847

fbshipit-source-id: c2ddb690ca897e46e00f07b491b91bb2bc8e847d
2021-04-12 00:05:43 -07:00
David Vacca 2793bba278 Move DisplayMode out of SurfaceHandler
Summary:
This diff moves DisplayMode out of SurfaceHandler, this is necessary in order to use it from react/uimanager package

changelog: [internal] internal

Reviewed By: ShikaSD

Differential Revision: D27669846

fbshipit-source-id: 274869d8f2907b1b159f51240440acece09a746f
2021-04-12 00:05:43 -07:00
David Vacca e7b52d7b0b Update initial props when DisplayMode changes in Fabric
Summary:
This diff updates initial props when DisplayMode changes in Fabric. This method will be called during pre-rendering.

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D27607586

fbshipit-source-id: 7625943d57a786d6dfe30dd893e27704f51826d2
2021-04-12 00:05:43 -07:00
Ramanpreet Nara f525ec0fe5 Remove assertions in ~Scheduler and ~SurfaceHandler
Summary:
~Scheduler and ~SurfaceHandler both contain react_native_asserts that trip whenever we reload React Native with Fabric enabled. These asserts trip because of a memory leak in Fabric. These asserts do not run in production. We should fix the memory leak before re-enabling these assertions.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D27481220

fbshipit-source-id: 15c3d46f7efab9ed67a70714efe44b74b0acd385
2021-04-07 19:37:59 -07:00
Valentin Shergin 3dd92513c5 Fabric: Aligning UIManager::startSurface and UIManager::stopSurface signatures
Summary:
In the previous diff, we moved the destruction of a ShadowTree object from `UIManager::stopSurface` method. And the next logical step is to align `UIManager::startSurface` method with the symmetrical approach. Now `stopSurface` accepts a unique pointer to a ShadowTree and `stopSurface` returns it back to the caller; this way we can avoid returning a raw pointer from `startSurface`.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D27010533

fbshipit-source-id: b9211fb7e67763cc190d6b8c86cb866d20c6693d
2021-03-23 13:41:47 -07:00
Valentin Shergin fa64427236 Fabric: Fixed deadlock in Surface Handler
Summary:
As part of stoping a Surface, we have to commit an empty shadow node tree. And to avoid a deadlock we have to do it not under a `linkMutex_`. To do so, we need to move the part that commits an empty tree from UIManager to SurfaceHandler. And this diff does exactly this.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D27010535

fbshipit-source-id: 60cc79b1c81d7340b550e78653737d2cc5bec24d
2021-03-12 08:57:57 -08:00
Andrei Shikov 8dc5ca6a6a Use SurfaceHandler in ReactSurface
Summary:
Changelog: [Internal]

Updates `ReactSurface` to use `SurfaceHandler` internally.
This removes most of the internal state in `ReactSurface` and propagates all the calls to the `SurfaceHandler`.

`FabricUIManager` now uses `SurfaceHandler` to start/stop the surface.
SurfaceId is still used for view operations. SurfaceId is also now mutable to play better with existing Android infra.

Reviewed By: shergin, mdvacca

Differential Revision: D26112992

fbshipit-source-id: 52e6860084d739381317035dc3011956d452063c
2021-03-08 12:20:41 -08:00
Samuel Susla 542c7cc357 Pass layoutDirection to surface handler
Summary:
Changelog: [internal]

During transition to SurfaceHandler, layoutDirection got lost. This diff adds it back.

Reviewed By: JoshuaGross

Differential Revision: D26775873

fbshipit-source-id: 9b638b4c2a41eb887312b968a2e113c5fcd7463d
2021-03-04 02:19:00 -08:00
Joshua Gross b3930f935f Convert most Fabric Cxx code to use react_native_assert instead of assert
Summary:
See react_native_assert.{h,cpp}. Because of the BUCK+Android issue where NDEBUG is always defined, we use react_native_assert instead of assert to enable xplat asserts in debug/dev mode.

This migrates most of the codebase, but probably not 100%. The goal is to increase assertion coverage on Android, not to get to 100% (yet).

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D26562866

fbshipit-source-id: a7bf2055b973e1d3650ed8d68a6d02d556604af9
2021-02-19 20:52:52 -08:00
Valentin Shergin 7a290d1596 Fabric: Introducing SurfaceHandler
Summary:
This implements `SurfaceHandler`, a new primitive for controlling the Surface life-cycle that ensures ownership, preserves state, maintains internal invariants, and simplifies surface manipulation from the application side.

For now, all this is an unused code. The coming diff will introduce an experiment that will route all surfaceId-based APIs to SurfaceHandler-based ones.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24290777

fbshipit-source-id: f2ff2b58e6d46e971a548f9f02113a1c783c4940
2021-01-29 07:54:19 -08:00