Commit Graph

14 Commits

Author SHA1 Message Date
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08: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
Andrew Coates 4d87d8c6b2 Fix various c++ warnings (#31399)
Summary:
react-native-windows runs with a more strict set of warnings as errors.  This fixes a bunch of warnings being hit while compiling core react-native code as part of react-native-windows.  In particular warnings about mismatched signed/unsigned comparisons, lossy conversions, and variable names that conflict with names in outer scopes (yoga has a global for `leading` and `trailing` that conflicts with some local variable names)

## Changelog

[Internal] [Fixed] - Fix various C++ warnings

Pull Request resolved: https://github.com/facebook/react-native/pull/31399

Test Plan: I've run these changes in react-native-windows. -- Shouldn't have any functionality difference.

Reviewed By: sammy-SC

Differential Revision: D28290188

Pulled By: rozele

fbshipit-source-id: 2f7cf87f58d73a3f43510ac888dbcb9ab177d134
2021-05-12 12:35:33 -07:00
Joshua Gross c22b874fd6 Differ: ensure ownership of all ShadowView/ShadowNode pairs, ensure consistency of nodes
Summary:
Previously, `ShadowViewNodePair::List` owned each `ShadowViewNodePair` but whenever we put `ShadowViewNodePair` into a TinyMap, those were unowned pointer references. This worked... 99% of the time. But in some marginal cases, it would cause dangling pointers, leading to difficult-to-track-down issues. So, I'm moving both of these to be unowned pointers and keeping a `std::deque` that owns all `ShadowViewNodePair`s and is itself owned by the main differ function. See comments for more implementation details. I'm moderately concerned about memory usage regressions, but practically speaking this will contain many items when a tree is created for the first time, and then very few items after that (space complexity should be similar to `O(n)` where `n` is the number of changed nodes after the last diff).

See comments as to why I believe `std::deque` is the right choice. Long-term there might be data-structures that are even more optimal, but std::deque has the right tradeoffs compared to other built-in STL structures like std::list and std::vector, and is probably better than std::forward_list too. Long-term we may want a custom data-structure that fits our needs exactly, but std::deque comes close and is possibly optimal.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27730952

fbshipit-source-id: 2194b535439bd309803a221188da5db75242005a
2021-04-14 19:50:10 -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
Andres Suarez 0f4f917663 Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25861683

fbshipit-source-id: 616afca13ae64c76421053ce49286035e0687e36
2021-01-09 22:11:00 -08:00
Valentin Shergin 9a720ad47f Fabric: buildStubViewTreeWithoutUsingDifferentiator & buildStubViewTreeUsingDifferentiator
Summary:
After fixing `calculateShadowViewMutationsForNewTree` I realized that it will be even better to test Stacking Context and mutation instructions infra using both functions: `calculateShadowViewMutationsForNewTree` (used for testing) and the Differentiator itself. This diff implements it.

Now we have two similarly working functions with different implementations that we can use for testing Differentiator and other parts of the infra.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25576922

fbshipit-source-id: 7922e9ebfb9d6ef1792566554ba0c4a14f835ae2
2020-12-16 10:57:37 -08:00
Valentin Shergin 426b19073d Fabric: calculateShadowViewMutationsForNewTree now takes order-index into account
Summary:
Working on zIndex tests I found that calculateShadowViewMutationsForNewTree (that we use for testing) does not take zIndex into account. This fixes it.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25576923

fbshipit-source-id: a71b3a4630430488c783cd5010c0fbb7273bdaa5
2020-12-16 10:57:37 -08:00
Joshua Gross 6864e5f3ac Ship reparenting differ everywhere on iOS and Android
Summary:
The "reparenting differ" has been the default differ for several months; ship it by removing config and the old differ.

Some functions can't be deleted yet because unit testing relies on it heavily; this can be refactored in the future if we care a lot.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25257205

fbshipit-source-id: 6f1dcc490bb1efe3d12506addf5f0843ca48c5c6
2020-12-01 19:52:44 -08:00
Samuel Susla 5af6a44de3 Back out "Back out "[RN] Fabric: Strengthening StubView mutating validation""
Summary:
Changelog: [internal]

Original commit changeset: b6109a45f153

Reviewed By: JoshuaGross

Differential Revision: D25020497

fbshipit-source-id: c52d5ad03dd1049ac66ecb2d82b5018a05bb4f19
2020-11-19 11:57:55 -08:00
Samuel Susla 53862a1b5a Back out "Fabric: Strengthening StubView mutating validation"
Summary:
Changelog: [internal]

Original commit changeset: 8c8a3d8e205c

Reviewed By: ShikaSD

Differential Revision: D24951341

fbshipit-source-id: b6109a45f1537a9edc702eafac1736e801fbedc9
2020-11-13 08:50:52 -08:00
Valentin Shergin 97a4598bab Fabric: Strengthening StubView mutating validation
Summary:
This diff adds more enforcement for consistency of `ShadowNodeMutation`s, including:
* `Props` object for newly created or updated view must not be nullptr;
* `oldShadowView` must describe the previous state of the view for `Update` instruction;
* `ignoreDuplicateCreates` option was removed.

I suspect some of the crashes we see in Fabric are caused by a violation of one of these constraints. If one of these fails in debug builds, we will get an early signal.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D24880821

fbshipit-source-id: 8c8a3d8e205ce34f6e0335e8a2b0cf676930c284
2020-11-11 10:56:27 -08:00
Joshua Gross dd05ec3801 StubViewTree: add additional verbose logging, make slightly more resilient
Summary:
1. When testing major changes to the differ, it can be useful to have more verbose logging.
2. On Android, since asserts don't fire yet, I log which asserts are failing.

Should have no impact on any builds unless you manually set the macro here, and it will have no impact on production builds regardless.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D23257859

fbshipit-source-id: 94a8e74ece8023064de0f2203db6074975f8f1f0
2020-08-24 13:09:12 -07:00
David Vacca 8cfd329e9f Extend 'mounting' module to compile in OSS
Summary:
This diff extends the 'mounting' module to compile in OSS

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D22918205

fbshipit-source-id: 424e33c827cb03befaaed32897a19cd6eff2dd71
2020-08-06 11:53:04 -07:00