Граф коммитов

130 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla d540f88df8 Initialise RuntimeScheduler before bundle is executed
Summary:
Changelog: [internal]

RuntimeScheduler can be accessed before any Fabric surface is rendered. Therefore, it needs to be created and installed in the runtime at the start up of the runtime.

Reviewed By: JoshuaGross

Differential Revision: D29091848

fbshipit-source-id: ff75ef8c4882550795e5d4a258355b651cb0e637
2021-06-14 10:52:09 -07:00
Samuel Susla 80ceedc0d8 Wire shouldYield flag to a feature flag
Summary:
Changelog: [internal]

Add a feature flag to enable yielding in RuntimeScheduler

Reviewed By: JoshuaGross

Differential Revision: D28903226

fbshipit-source-id: c361ca144a2d531e8aa671bc8875bce075e13a2c
2021-06-04 12:08:52 -07:00
Samuel Susla 0ee8e292a4 Fix for ScrollView race condition between C++ state update and onScroll
Summary:
Changelog: [internal]

There is a possibility of race between updating scrollview's state and virtualised list asking for layout of individual cells.
To make sure the race doesn't happen, state must be updated before dispatching onScroll event.

Android has implemented a different mechanism to tackle this issue in D28558380 (b161241db2).

Reviewed By: JoshuaGross

Differential Revision: D28642737

fbshipit-source-id: 33874beac69fc5a66eeb7f459fd89cd0b00dafcf
2021-05-26 03:32:03 -07:00
Samuel Susla 3a9e14e8a9 Add synchronous access to the runtime to RuntimeScheduler
Summary:
Changelog: [internal]

Introduces synchronous access to the runtime from RuntimeScheduler.
At the moment, this is not used anywhere.

In case RuntimeScheduler isn't defined (controlled by MC), falls back to RuntimeExecutor.

Reviewed By: mdvacca

Differential Revision: D28024380

fbshipit-source-id: 90be36dd390202540ed51940a4396040f043cd90
2021-05-25 07:42:06 -07:00
Samuel Susla 4bec099f7e Add option to disable sending scroll events to Paper
Summary:
Changelog: [internal]

Originally added in D17814260 (ffc7ec992c) to make parallax effect work in Dating.

This diff hides it behind a flag so we can properly evaluate what's the cost of sending scroll events to Paper.

Reviewed By: JoshuaGross

Differential Revision: D28608283

fbshipit-source-id: fa4d8944ad6b5e767363e231942f13fec9d18cb5
2021-05-22 12:19:05 -07:00
Samuel Susla 118489f6e5 Make LeakChecker available on Android
Summary:
Changelog: [internal]

Extend LeakChecker so it is available on Android (or any other platform as it is completely in C++ now).

Reviewed By: JoshuaGross

Differential Revision: D28600243

fbshipit-source-id: c77a003e3ffc6171e61c998508c9f34f10bb65ca
2021-05-21 10:39:43 -07:00
Samuel Susla 9b3c12dc87 Funnel All Fabric calls to RuntimeExecutor to RuntimeScheduler
Summary:
Changelog: [internal]

This diff moves all calls to RuntimeExecutor to RuntimeScheduler. The calls are still immediately dispatched. Timing of events will not change.

The goal of this diff is to prepare infrastructure for Concurrent Mode.

Reviewed By: JoshuaGross

Differential Revision: D27937665

fbshipit-source-id: 434d78c95ccf23d8da41186d0dae91bff4eda384
2021-05-13 08:03:29 -07:00
Samuel Susla ad2f1caf9a Clean up optimized_hit_testing_ios
Summary:
Changelog: [internal]

Clean up the experiment

Reviewed By: JoshuaGross

Differential Revision: D27996499

fbshipit-source-id: 3c9598846b3800eef86d039580e6a12e7273e798
2021-04-30 06:11:55 -07:00
Joshua Gross a249065503 Pass "blockNativeResponder" param to RCTMountingManager
Summary:
From looking at other implementations of setJSResponder, we need the MountingManager to have access to "blocksNativeResponder" param, but do not need to pass that through to individual views (see also Android implementation).

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D28066257

fbshipit-source-id: e1420431478fd27d2e1463e291a0bbc600d3f0a6
2021-04-29 09:29:45 -07:00
Samuel Susla 1b592631a7 Prevent redundant dispatches onto RuntimeExecutor queue in AsynchronousEventBeat::induce
Summary:
Changelog: [internal]

Current implementation of `AsynchronousEventBeat` dispatches lambdas through `RuntimeExecutor` regardless if it has done so previously.

So if `AsynchronousEventBeat::induce` is called 30 times, it will dispatch 30 lambdas.

In `AsynchronousEventBeatV2`, we make sure only single lambda is dispatched to `RuntimeExecutor` at a time.

Reviewed By: mdvacca

Differential Revision: D27940300

fbshipit-source-id: 2bad25c86315c1712b4a1da8c1d4702734cec70f
2021-04-24 03:21:09 -07:00
Samuel Susla 976a305412 Remove clean up resources when the app is backgrounded experiment
Summary:
Changelog: [internal]

Experiment didn't move any metrics. Let's get rid of it.

Reviewed By: mdvacca

Differential Revision: D27588183

fbshipit-source-id: 55404a3d756971ee34d4a86acd1027ed077692c0
2021-04-07 17:01:04 -07:00
Peter Argany ac7ba3ea16 Fix leak checker crash in bridgeless mode
Summary:
Fast follow to D26727461 (34d189ae09), in bridgeless mode, `_contextContainer` doesn't have bridge, so avoid setting up `garbageCollectionTrigger`.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27173725

fbshipit-source-id: 5530c43638c17fb03e065c11667786efe9f3ef11
2021-03-18 18:29:38 -07:00
Samuel Susla 34d189ae09 Introducing Leak Checker
Summary:
Changelog: [internal]

Introducing LeakChecker. A tool that checks if all native components have been cleaned up when surface is stopped.

**Known shortcomings**:
- LeakChecker is only enabled in debug builds and the existence of leaks is logged to console.
- For now, Leak Checker looks at N-1 screen. This is intentional as there is a known limitation of React that doesn't free up all shadow nodes when surface is stopped. Because of this, the use of LeakChecker is not intuitive and I'll work with React team to try to work around this.
- It doesn't help locating the leak, it only informs that leak is present. I'll be looking into ways to help locate the leak.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D26727461

fbshipit-source-id: 8350190b99f24642f8e15a3c2e1d79cfaa810d3d
2021-03-17 02:57:37 -07:00
Valentin Shergin 013b39f32c Fabric: Using `SurfaceHandler` on iOS
Summary:
(This is the second version of the diff that includes additional checkes and syncronization around `start` and `stop` methods).

This diff migrates iOS renderer to using SurfaceHandler directly instead of calling Scheduler methods.

Major changes:
* RCTFabricSurface only stores a SurfaceHandler and platform-specific parts (such as a UIView instance and TouchHandler); all other pieces of state are stored in SurfaceHandler object.
* All the state changes initiated from RCTFabricSurface are performed via calling corresponding methods on SurfaceHandler (bypassing RCTSurfacePresenter, RCTScheduler, Scheduler, and UIManager).
* Every RCTSurfaceHandler is responsible for observing `UIContentSizeCategoryDidChangeNotification` and communicating the change down to SurfaceHandler. (Besides code simplifications it's more correct because on iOS the DPI actually depends on a particular UIScreen/UIWindow associated with UIView and *not* global for the whole app.)

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: ShikaSD

Differential Revision: D26614577

fbshipit-source-id: 428f4c4cc1ca46cd97be0413e9279e29a54807f6
2021-02-24 08:29:35 -08:00
Valentin Shergin 0bb459b149 Back out "Fabric: Using `SurfaceHandler` on iOS"
Summary:
This is a backout of D24290778 (33d6091cac).
The original diff causes T85097896 and probably T85069775. For now I am going to unland this, and then I will re-land this after the cut with a fix.

Original commit changeset: 62b600c3f1b2
Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26515027

fbshipit-source-id: 057663b092e6b1d74db83c40d656b2ae142bd622
2021-02-18 12:41:27 -08:00
Valentin Shergin 33d6091cac Fabric: Using `SurfaceHandler` on iOS
Summary:
This diff migrates iOS renderer to using SurfaceHandler directly instead of calling Scheduler methods.

Major changes:
* RCTFabricSurface only stores a SurfaceHandler and platform-specific parts (such as a UIView instance and TouchHandler); all other pieces of state are stored in SurfaceHandler object.
* All the state changes initiated from RCTFabricSurface are performed via calling corresponding methods on SurfaceHandler (bypassing RCTSurfacePresenter, RCTScheduler, Scheduler, and UIManager).
* Every RCTSurfaceHandler is responsible for observing `UIContentSizeCategoryDidChangeNotification` and communicating the change down to SurfaceHandler. (Besides code simplifications it's more correct because on iOS the DPI actually depends on a particular UIScreen/UIWindow associated with UIView and *not* global for the whole app.)

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24290778

fbshipit-source-id: 62b600c3f1b2e66a7513481404af941ef8b78bec
2021-02-09 08:10:43 -08:00
Valentin Shergin fc24bb4af0 Fabric: Support for `setIsJSResponder`, all the native changes
Summary:
This is a Fabric-compliant implementation of `JSResponder` feature. To make it work e2e we also need to update FabricRenderer in React repository. But before we can do this, we need to ship the native changes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D24630027

fbshipit-source-id: 70c30e1250b554d83862956b536714704093072f
2021-02-04 13:16:29 -08:00
Valentin Shergin 1ee87e1f97 Fabric: Simplifying the integration among RCTSurfacePresenter, RCTMountingManager, and RCTFabricSurface
Summary:
Changes:
* RCTMountingManager got two dedicated methods that designate some external view as a Surface viewport;
* The wiring between views now happens right in `start` and `stop` methods (because there is no reason to do it later); now it's symmetrical and straightforward;
* A couple of Surface legacy statuses were removed; they are not used and do not convey useful information anyway.
Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26095434

fbshipit-source-id: 37828e093a40a1ad22ad78f110c18a8f27781ba7
2021-02-01 11:41:16 -08:00
Samuel Susla 8695980e1e Add experiment to clean up resources when the app is backgrounded
Summary:
Changelog: [internal]

Setup an experiment to measure impact of releasing resources when the app enters background.

Reviewed By: JoshuaGross, shergin

Differential Revision: D25952690

fbshipit-source-id: acfaa4a1689cc03c6020fdee62d3594859c9da3d
2021-01-20 10:08:13 -08: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
Joshua Gross e3a05c9e3e iOS implementation of sendAccessibilityEvent
Summary:
This is the iOS native implementation of sendAccessibilityEvent for Fabric.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25857401

fbshipit-source-id: e57d2e7fd45052bcf05cee7d0cb6c55ee974f358
2021-01-08 18:10:59 -08:00
Valentin Shergin d7b3daa643 Fabric: Removing `RCTExperimentSetSyncPerformanceFlag`
Summary:
Cleaning up an old experiment, it was `static true` for a couple of months already.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24642808

fbshipit-source-id: 50ba955490d848a9c1698e1c6d0c296e833386f3
2020-10-30 15:45:21 -07:00
Valentin Shergin 28e9528c4d Fabric: QE for Preemptive views allocation feature
Summary:
Fabric has a feature that preallocates views before mounting even need them. We never tested the impact of this feature thought. This diff adds a way to enable/disable it and run an experiment.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24355612

fbshipit-source-id: fefd653e57232044cd7b28b160e12a4ef85dbb8b
2020-10-16 17:56:58 -07:00
Valentin Shergin 2103839525 Fabric: Optimized hit-testing
Summary:
An experiment where we use `LayoutMetrics::overflowInset` to optimize performance of hit-testing algorithm.
In my measurements enabling this feature drastically (2x) reduced amount of calls to `hitTest:withEvent:` method.

Reviewed By: sammy-SC

Differential Revision: D23669091

fbshipit-source-id: ac6dadc90b6a2fbb45e41e0d4a113bd5ae8f1218
2020-09-15 22:29:30 -07:00
Valentin Shergin 661d34bb42 Fabric: Removing MainRunLoopEventBeat and RuntimeEventBeat (iOS)
Summary:
The `enable_run_loop_based_event_beat_ios` experiment was shipped a couple of months ago.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D23606061

fbshipit-source-id: e1926f46933d6603f20104f211c944c50173a627
2020-09-11 08:23:27 -07:00
Valentin Shergin b2570bd74d Removing `dispatch_async`-delayed TTRC reporting for Fabric TTRC tracker (gated)
Summary:
This diff introduces a new experiment touching performance measuring infra.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D23071089

fbshipit-source-id: 22e6f34754956311bd6a0140fe2accd5758d87c7
2020-08-12 12:12:47 -07:00
Samuel Susla 154ce78972 Take viewport offset into account in UIManager.measureInWindow
Summary:
Changelog: [Internal]

Fabric's UIManager.measureInWindow didn't take viewport's offset into account. This diff fixes it by including viewport's offset in `LayoutContext`.

Reviewed By: JoshuaGross

Differential Revision: D23021903

fbshipit-source-id: 9106a8789d66fe19d8cb0a9378ee5bc8f2c83005
2020-08-10 12:52:23 -07:00
Jiayan Zhuang df66b7a4d2 Add UIContentSizeCategoryDidChangeNotification to re-render text
Summary:
Changelog:
[Internal] - Add UIContentSizeCategoryDidChangeNotification to re-render text

We don't need to restart the app to re-render text now, but we still need to swipe the screen or click on buttons to force to refresh. We may address this in the future.

Reviewed By: PeteTheHeat

Differential Revision: D22867293

fbshipit-source-id: 4747a45adc2bdc638cf7ef9c07a9484e48600583
2020-08-04 15:12:14 -07:00
David Vacca 3093010ea5 move fabric to ReactCommon/react/renderer
Summary:
This diff moves fabric C++ code from ReactCommon/fabric to ReactCommon/react/renderer
As part of this diff I also refactored components, codegen and callsites on CatalystApp, FB4A and venice

Script: P137350694

changelog: [internal] internal refactor

Reviewed By: fkgozali

Differential Revision: D22852139

fbshipit-source-id: f85310ba858b6afd81abfd9cbe6d70b28eca7415
2020-07-31 13:34:29 -07:00
Valentin Shergin 8d613c6f32 Fabric: Implementation of BackgroundExecutor on iOS (and gating)
Summary:
This is an implementation of `BackgroundExecutor` on iOS.
In case if the experiment is successful, we will make it mandatory for all platforms.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D22743722

fbshipit-source-id: 7756d2947e962720b9970d48c74929ab407c0440
2020-07-24 23:52:48 -07:00
Valentin Shergin 26d8d41735 Fabric: More asserts in iOS mounting infra
Summary:
The change contains a bunch of additional asserts that verify some assumptions on which mounting relies on. Working on the previous diffs I realized that it's very easy to broke those and then spend hours trying to understand what exactly went wrong.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22324087

fbshipit-source-id: 1152c40248885d02bde62a493a574868c3732273
2020-07-01 20:37:49 -07:00
Valentin Shergin e223f2c2bf Fabric: Gating for on-demand view mounting in ScrollView
Summary:
Just gating.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22325692

fbshipit-source-id: 14cdfb4bf10ad00e090a91659138639360020fca
2020-07-01 18:25:14 -07:00
Samuel Susla fb2b49d298 Remove integration between Paper and Fabric's UIManager
Summary:
Changelog: [Internal]

In D8552360 (48b9a6f887) an experimental integration between old and new UIManager has been introduced.
It isn't needed anymore.

I did some measurements and it is the slowest part of `[RCTComponentViewDescriptor dequeueComponentViewWithComponentHandle]`.

{F241943384}

Reviewed By: shergin

Differential Revision: D22274782

fbshipit-source-id: 799ba047f1c57f68f00b0b6fa7c58782874991bc
2020-06-29 15:26:31 -07:00
Samuel Susla 36b586ada1 Font size in Text now respects preferredContentSizeCategory
Summary:
Changelog: [Internal]

Add support for dynamic font size.

New class `ThreadStorage` is introduced, which is used to pass LayoutContext to `YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector`.

## Shortcoming
This implementation doesn't cause re-render, if user changes font size and comes to the app without restarting it, it will show old font size. I believe this is fine for now as most people set their font size before they use the app and keep the same setting for a long time.

Reviewed By: shergin

Differential Revision: D22043728

fbshipit-source-id: 7453d165c280a2f4bcb73f4ee6daf9e64b637ded
2020-06-17 10:22:32 -07:00
Samuel Susla 16d15209e5 Remove branching for optimized differ QE
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21556312

fbshipit-source-id: 0d6d275de2d691cb42e5e70e5bf19bcc983cae12
2020-05-14 05:30:48 -07:00
Valentin Shergin f05fff6a68 Fabric: Using `PlatformRunLoopObserver` instead of `MainRunLoopEventBeat` and `RuntimeEventBeat` on iOS (gated)
Summary:
This diff implements iOS-specific `PlatformRunLoopObserver` (and `MainRunLoopObserver`) that then being glued together with `SynchronousEventBeat` replaces `MainRunLoopEventBeat`, and then same thing glued with `AsynchronousEventBeat` replaces `RuntimeEventBeat`.

So, instead of two platform-specific classes we had on iOS (for that needs), now we have only one (that can be reused for a more broad variety of applications).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341998

fbshipit-source-id: fafde4e678770f7fcf9c1ff87acc02812a37e708
2020-05-11 09:01:33 -07:00
Valentin Shergin 599f1edd9a Fabric: `scheduler` module was decoupled from `uimanager`
Summary:
We need to break up the `uimanager` module in order to solve circular dependencies problem (which future diff would have otherwise).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D20885645

fbshipit-source-id: 8148bd934879802b076261ed86fa78acf0a07ed3
2020-04-18 15:00:21 -07:00
Valentin Shergin e56950dc65 Fabric: `componentregistry` module was decoupled from `uimanager`
Summary:
We need to break up the `uimanager` module in order to solve circular dependencies problem (which future diff would have otherwise).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D20885163

fbshipit-source-id: 08eb1ba1d408fc0948e8d0da62380786a40973af
2020-04-18 15:00:21 -07:00
Valentin Shergin d7d585f587 Fabric: Controlling DifferentiatorMode via ReactNativeConfig
Summary:
Now we can control the differentiator mode via MC.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: fkgozali

Differential Revision: D20978857

fbshipit-source-id: 13264948762f02f874d8d051c873d378062d6db4
2020-04-11 12:15:55 -07:00
Samuel Susla 46722dcfc2 Swap left and right yoga position with start and end in RTL context
Summary:
Changelog: [Internal]

Paper swaps right and left in RTL setting, this logic is in [RCTShadowView.m](https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/React/Views/RCTShadowView.m?commit=cdd504cfbee66ae0659495604c4ff7b5764a1d9e&lines=529-549).

For Fabric instead of doing it during yoga props assignment, I swap the left/right with start/end just before we pass yoga nodes to layout calculation.

Reviewed By: shergin

Differential Revision: D20420040

fbshipit-source-id: b777f2658f56c173743b2034b8b5059e3e0c9840
2020-04-01 05:42:20 -07:00
Valentin Shergin 73448012cb Fabric: Fixing a deadlock in RCTSurfacePresenter
Summary:
This is another attempt to fix an issue very similar to T59424871. The previous attempt was in D19249490. I don't know why we don't see production crashes (stalls) but it happened to me (and not to me) in the debugger. The previous attempt didn't work because we still could have a deadlock because we tried to acquired shared mutex already owned exclusively by the `suspend` method.

Here is another approach: Instead of using one shared mutex, now we use two. One is similar to what we had and another that protects `suspend` and `resume`. Besides that, now we pass a Scheduler to functions that use that explicitly. This way we can be more explicit about acquiring mutexes and the overall flow of execution. The idea is: Now an arbitrary code that can be reentrant does not cover with mutexes, so the deadlock is not possible.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20639228

fbshipit-source-id: 98515742f00f2ae94b50b585c9f1f0611e169ebe
2020-03-26 10:13:43 -07:00
Samuel Susla 71c7e80bfd Add RTL support
Summary:
Changelog: [internal]

layoutDirectionPass down layoutDirection from `RCTSurfacePresenter` down to `YogaLayutableShadowNode`.

In `ParagraphShadowNode`, we propagate layoutDirection from yoga node to `TextAttributes.layoutDirection`.

Reviewed By: shergin

Differential Revision: D20420041

fbshipit-source-id: 86e01d31ea9415acb8579c44c470cac870ec1b8f
2020-03-17 14:09:28 -07:00
Samuel Susla 3ee1e5312a Back out "Rename measure to measureContent and pass it LayoutContext"
Summary:
Original commit changeset: 8928b59d5194

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D20246918

fbshipit-source-id: 0b9142d9bc4774a07304769126411a34cc8c33c5
2020-03-04 05:01:53 -08:00
Samuel Susla 74034ba23a Back out "Font size in Text now respects preferredContentSizeCategory"
Summary:
Original commit changeset: 3965a127069a

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D20246919

fbshipit-source-id: d2238f279f44ac4394557949c8f148f08a60647e
2020-03-04 05:01:53 -08:00
Samuel Susla 08dda02347 Font size in Text now respects preferredContentSizeCategory
Summary:
Changelog: [Internal]

Use LayoutContext to pass `fontSizeMultiplier` down to ParagrapShadowNode.

Reviewed By: shergin

Differential Revision: D20184596

fbshipit-source-id: 3965a127069a21328ed19cb3f9732f0a2d1c4d58
2020-03-03 04:14:04 -08:00
Samuel Susla b40f0562f5 Rename measure to measureContent and pass it LayoutContext
Summary:
In order to build dynamic text sizing, `LayoutableShadowNode::measure` needs to accept `LayoutContext`

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D20184598

fbshipit-source-id: 8928b59d51948caf3654f40049212a89a91dceb6
2020-03-03 04:14:04 -08:00
Samuel Susla 12b43ef418 Implement RCTFabricSurface.synchronouslyWaitForStage
Summary:
Changelog: [Internal]

Exposes `synchronouslyWaitForStage` to `RCTFabricSurface`.

This is a first step towards having screenshot tests rendered with Fabric.

Reviewed By: shergin

Differential Revision: D19603837

fbshipit-source-id: 26c14cf3bbd67fea96319ff08d3321557ddcdd9c
2020-01-30 10:11:12 -08:00
Valentin Shergin 9c1412882e Fabric: Using shared mutex to protect scheduler object in RCTSurfacePresenter
Summary:
This fixes a deadlock caused by recursive calling of `-[RCTSurfacePresenter setMinimumSize:minimumSize:]` (because of an attempt to lock the mutex which was already locked upper the call stack).
Seems there is no reason why this operation should not be allowed. This diff replaces a regular mutex with a shared one which allows multiple shared locks and this prevents the deadlock. A Scheduler is already a thread-safe object and the mutex only protected the mutation of a pointer to it.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D19249490

fbshipit-source-id: 00e8934c6502328f34b78ea6ec004b7216665db1
2019-12-30 11:21:42 -08:00
Samuel Susla e33b276084 Component views are now loaded through C function rather than delegate
Summary:
I moved towards C function to return component class instead of delegate.

We need this in order to register components that are optimistically registered, such as View, Image and Text.

In D19088558, we need this in order to register Image.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19088559

fbshipit-source-id: 061f3ba15dfb44b9acce7be2dc6828b9afbecbfa
2019-12-19 07:35:37 -08:00
Valentin Shergin 3aba90b58a Fabric: Workaround for mysterious crash in `synchronouslyUpdateViewOnUIThread:props:`.
Summary:
We are seeing some non-trivial amount of crashes happened because `[RCTSurfacePresenter synchronouslyUpdateViewOnUIThread:props:]` requests a Component Descriptor which does not register in the registry.
And the problem here is that ComponentDescriptors are not being designed to be used outside of C++ UIManager, and we only use that in RCTSurfacePresenter only because it's an old workaround that makes Native Animation Driver works with Fabric.

Messing with ComponentDescriptors are in general dangerous. Accessing them outside of UIManager means that they might be deallocated at any time, extending their lifetime will cause other crashes on the other side. So, that's why this is "BROKEN".

This diff does not make the code worse, it just designates the problem that was there for a long time, so it kinda makes it better.

We don't know for sure why some ComponentDescriptors are not registered but this diff at least makes it not crash in such case.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D18869651

fbshipit-source-id: 9d945ac7a2bd24a69a9bbb83b4fdd3cd19808f87
2019-12-06 17:58:35 -08:00