Summary: Previously we had a single `commit` function that accepts an argument that enables auto-retry mechanism. As Spencer pointed out, that wasn't so useful and clear. So, I split the method into two with more expressive names.
Reviewed By: sahrens
Differential Revision: D13681594
fbshipit-source-id: 529f729d597206e9a0ac940f005a1569a9bef707
Summary:
I read my code and one thing stroke me: What if the same event emitter dispatches several events during the same event beat? In the previous implementation, only the first one will be delivered because the first `release` call consumes stored strong reference.
So, I changed the API a bit to make this more explicit: we have `retain` & `release` methods and we have a getter that works (multiple times) only if the object was successfully retained.
Reviewed By: sahrens
Differential Revision: D13668147
fbshipit-source-id: c00af5f15bc7e30aa704d46bd23584b918b6f75a
Summary: This diff implements a new algorithm that effectively marks `EventEmitter`s enabled or disabled. The previous implementation relied on a list of mutation instructions whereas the new one analyzes the shadow trees. The mutations-based approach didn't work well because mutations describe `ShadowView`s whereas some `ShadowNode`s are simply not views (like VirtualText), but we have to enable/disable them anyway.
Reviewed By: sahrens
Differential Revision: D13642594
fbshipit-source-id: 12169e11d5685e50bcd0d8c410498c594df744b4
Summary: See the diff for more details.
Reviewed By: sahrens
Differential Revision: D13642593
fbshipit-source-id: 8bdcc91bcc2ea1e4093bcac03d87167b8901cbb4
Summary: The mutex is a "leaf" mutex, so the code cannot reenter that, so there is no reason to be a recursive one.
Reviewed By: sahrens
Differential Revision: D13642592
fbshipit-source-id: 0fb64d3405c5d3408251dc983c186f6747bc6ee2
Summary:
EventTargetWrapper and EventTarget were merged into one class that controls an `instanceHandle` reference and extracting a strong reference to it.
This diff also decouples the operation of retaining a strong reference (with checking a `enabled` flag) from actual usage of this reference. This allows to wrap into a mutex only first part of this process and avoid possible deadlocks.
Reviewed By: sahrens
Differential Revision: D13616382
fbshipit-source-id: 9907bc12047386fcf027929ae2ae41c0b727cd06
Summary:
For some time we have had a nit trick inside `EventEmitter`: When event emitter is disabled, we switch to store `EventTarget` as a weak pointer instead of complete deleting it. Given some unpredictability of JS GC, it gave us some time to restore the pointer in case if we increment the counter right after decrementing this. Apparently, we found that it doesn't always work (obviously, sigh...), so we implement the `enableCounter_` and left this feature as it is assuming that it can nice optimization that illuminates some unnecessary constraints.
But, apparently, it's actually harmful, assuming that `jsi::WeakObject` (that thing that we use to refer to actual JS target) actually has "unsafe unretained" (not "weak") semantic.
So, we have to remove this.
This change will be particularly important for coming diffs in the stack.
Reviewed By: mdvacca
Differential Revision: D13324480
fbshipit-source-id: 4c4da2984dc6a36b94b564bc9eee144142b430b0
Summary: Because it was not idiomatic anyway. There is no point having a pointer to RootShadowNode without any guarantees that it's the current one. Using `commit` method makes this concern explicit.
Reviewed By: sahrens
Differential Revision: D13615363
fbshipit-source-id: f71ffc3c55dbdc69624933eb8b92334ed793c794
Summary:
Removing additional complexity from ShadowTree should help with maintainability. Now, this class is "tricky", but short at least.
With new `commit` API, it's much more simple and expected this way.
Reviewed By: sahrens
Differential Revision: D13615365
fbshipit-source-id: 1fe851c1a2d3bdc7ac2f4a570cf0170eae3c4c67
Summary: Now it's parts of RootShadowNode and Scheduler.
Reviewed By: sahrens
Differential Revision: D13615364
fbshipit-source-id: 13dbea1e69ef51b2679101915c01c6be7e15d859
Summary:
Instead of the whole family of commit* and complete* methods, now we have one single `commit` method which performs pre- and post-commit operations and swap pointers in a thread-safe manner. The `commit` operation is also exposing `revision` number and allows perform multiple commit attempts.
`completeByReplacingShadowNode`, `measure` and `constraintLayout` are also going away to RootShadowNode class in the next commits.
Why?
* Nicer API;
* No more recursive_mutex, no more problems with thread jumps;
* All mutex locks are now leaf-locks, so no more deadlocks possible;
* Exposing `revision` should help with debugging races.
Reviewed By: sahrens
Differential Revision: D13613942
fbshipit-source-id: 94e797d2f7860717847e823b5d97c4f7b35f08df
Summary: This diff open sources Fabric Android implementation and it extracts ComponentDescriptorFactory into a function that can be "injected" per application
Reviewed By: shergin
Differential Revision: D13616172
fbshipit-source-id: 7b7a6461216740b5a1ad5ebbead9e37de4570221
Summary:
After this diff D13403925 that got rid of `-ffast-math` we started to have a very odd behavior on Yoga when using release builds.
After digging a while we found that certain set of conditions on O2 and O3 optimization levels was causing Origami to set some `INFINITE` values on Yoga.
We found the root of the problem and fix it on Origami side. But I'm wondering if guarding agains `INFINITE` on Yoga side would be good too. Since now Yoga it's not using `-ffast-math` anymore, and I think infinite is not a a valid value anywhere on Yoga side, it seems to support the reason to guard against it.
I'm happy to abandon this diff if you guys think this is not a good solution.
Reviewed By: davidaurelio
Differential Revision: D13679319
fbshipit-source-id: 061448fea9d1a8496362ff07dc46b546e7f1ffa3
Summary:
@public
Repeated application and alternation of Clang Format rules has lead to unfortunate block comment formatting.
Here, we reflow comments
Reviewed By: SidharthGuglani
Differential Revision: D13677242
fbshipit-source-id: 3f1f5e38693eb15e9705f24fd363fc1618c78974
Summary:
@public
These URLs probably have been changed when CSSLayout was renamed to Yoga by search & replacing
Reviewed By: SidharthGuglani
Differential Revision: D13690829
fbshipit-source-id: 44dbd8fe256fc286006d164390609a7c3de6c4e6
Summary: We are now generating the native cpp files for Switch via Buck. Deleting the hand written files and switching over.
Reviewed By: JoshuaGross, mdvacca
Differential Revision: D13666672
fbshipit-source-id: 72cf6f6af9374511f2742f8f0d996fa52e1bff5b
Summary:
This commit moves all the turbo module files for Android to Github.
Note that gradle build is not yet enabled.
Sample Turbo Modules will be added in a later commit.
Other missing features
- Support for `CxxModule`
- Remove usage of folly::dynamic for arguments and result conversion
- Support for Promise return types.
Reviewed By: mdvacca
Differential Revision: D13647438
fbshipit-source-id: 5f1188556d6c64bfa2b2fd2146ac72b0fb456891
Summary:
@public
Removes all `YG...Count` macros for enums and replaces them with `facebook::yoga::enums::count<YG...>()`.
This removes the need to manually maintain enum counts.
Same as D13597449, working around a defect in clang < 3.9
Reviewed By: amir-shalem
Differential Revision: D13634622
fbshipit-source-id: 344dc70e167b0caf746fe396cedd200f54e52219
Summary:
@public
Removes all `YG...Count` macros for enums and replaces them with `facebook::yoga::enums::count<YG...>()`.
This removes the need to manually maintain enum counts.
Reviewed By: shergin
Differential Revision: D13597449
fbshipit-source-id: edcee225ada4058e94f3a727246763e3cc45873d
Summary:
@public
Wraps enum definition in a single macro.
Down the line, this will allow us to add more functionality:
- Replace manual counts with `yoga::enums::count<YG...>()`
- `yoga::enums::max<YG...>()`
- A bitfield implementation with known memory layout using `max<>()`
Reviewed By: SidharthGuglani
Differential Revision: D13597259
fbshipit-source-id: 543a11a53090bedf1474d00328565ed57d059e23
Summary:
The original commit was backed out due to a build failure, which seems to be due to compiler flag misconfiguration. That has been fixed.
Original commit: f2fccbb327
Reviewed By: mdvacca
Differential Revision: D13593075
fbshipit-source-id: f3a65e8bd9830f6ac2ea829020500b4632ee2149
Summary: This diff ensures that the 'measure' method in TextLayoutManager is memoized using a static variable.
Reviewed By: fkgozali
Differential Revision: D13585508
fbshipit-source-id: 9275a4d193b8abb0c3aaffd5a5535234717475e1
Summary:
This is the iOS binding for TurboModule.
To install the TurboModule binding:
* Provide `RCTCxxBridgeDelegate`
* Provide `RCTTurboModuleManagerDelegate`
Somewhere in `RCTCxxBridgeDelegate` impl:
```
RCTTurboModuleManager *manager = [[RCTTurboModuleManager alloc] initWithRuntime:&runtime bridge:bridge delegate:self];
[manager installJSBinding];
```
Doing so will install `global.__turboModuleProxy()` in JS space.
Note:
* The full instructions will be provided once all pieces are moved to OSS.
* Sample modules and binding setup will be provided later.
Reviewed By: RSNara
Differential Revision: D13583442
fbshipit-source-id: bb1cabd973e8a9ec59da6b145826e9ea234a96b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/22231
- Use clang instead of the deprecated gcc
- Use libc++ instead of the deprecated gnustl
- Updated gradle and android plugin version
- Fixed missing arch in local-cli template
- `clean` task should now always succeed
- `clean` task deletes build artifacts
- No need to specify buildToolsVersion. It's derived.
- Elvis operator for more readable code
Pull Request resolved: https://github.com/facebook/react-native/pull/22263
Reviewed By: hramos
Differential Revision: D13004499
Pulled By: DanielZlotin
fbshipit-source-id: da54bb744cedb4c6f3bda590f8c25d0ad64086ef
Summary:
This change enables defining the macro at a more global and central location. And thereby allowing us to building this file using MSVC.
Pull Request resolved: https://github.com/facebook/react-native/pull/22561
Reviewed By: fkgozali
Differential Revision: D13529762
Pulled By: RSNara
fbshipit-source-id: c78abb26f47aba25d50305c5bc0b23b6568f1243
Summary:
This is only the core C++ part of TurboModule - moving to github to make integration with existing NativeModules system slightly easier. Other bindings for iOS/Android are not yet ready to move.
Notes:
* TurboModules is not ready to use at the moment.
* Build configuration is not yet provided (cocoapods/.xcodeproj/gradle), just like Fabric.
* No effort was done to make this lib C++17 strictly compliant yet (there will be in the future).
Reviewed By: RSNara
Differential Revision: D13551211
fbshipit-source-id: cd3b458e6746ee9218451962ca65b1ad641a32db
Summary:
This diff fixes a race condition that was detected on "Marketplace You" production test for Android.
The race condition happens when the method ShadowTree::complete is executed concurrently from two threads (in this case this is called from Scheduller::constraintSurfaceLayout and Scheduler::uiManagerDidFinishTransaction), based on the order of execution this bug makes MountViewItems to be dispatched to the UI in the wrong order.
The root cause of the bug is in the method:
```
bool ShadowTree::complete(
const SharedRootShadowNode &oldRootShadowNode,
const UnsharedRootShadowNode &newRootShadowNode) const {
newRootShadowNode->layout();
newRootShadowNode->sealRecursive();
auto mutations =
calculateShadowViewMutations(*oldRootShadowNode, *newRootShadowNode);
if (!commit(oldRootShadowNode, newRootShadowNode, mutations)) {
return false;
}
emitLayoutEvents(mutations);
if (delegate_) {
delegate_->shadowTreeDidCommit(*this, mutations);
}
return true;
}
```
Notes:
- the commit method is guarded by the commitMutex_
- the shadowTreeDidCommit() method dispatches mutations instructions to the platform side.
- If there are two threads running concurrently, there is no guarantee that the shadowTreeDidCommit() is going to be called in the correct order.
The solution is to include the execution to shadowTreeDidCommit() in the same commitMutex_
Possible solutions:
1 - move the commitMutex_ out of the commit method (to the completeMethod)
2 - synchronize the call to complete method() - this is the implemented solution.
I chose this solution to make it consistent with the way Scheduler::constraintSurfaceLayout is implemented (https://fburl.com/8l49no5x)
This mechanism is very likely to change in the refactor of threading mechanism that Valentin Shergin is going to be working on January.
I would like to land this, so we can fix this bug and run another experiment in production as soon as possible.
Reviewed By: sahrens
Differential Revision: D13535587
fbshipit-source-id: bedd4d85f5569ab3733c302d1328aa48017bcaad
Summary:
shergin mentioned that he'd like to move away from RTTI a bit and use explicit key strings for context container instances rather than relying on the `typeid`, so this does this.
We also fatal with a useful error message if we get a collision, rather than failing silently.
Reviewed By: shergin
Differential Revision: D13384308
fbshipit-source-id: 0b06d7555b082be89e8f130c23e94be99749a7a3
Summary: We need a way for different apps to inject dependencies or additional functionality into Fabric - ReactNativeConfig might be a special case, but I think this could clean up it's integration nicely, and I'm using this for a uitemplate cache system so we can use CompactDisk or other storage systems for caching depending on the app.
Reviewed By: mdvacca
Differential Revision: D13407287
fbshipit-source-id: 45481908434e6235850aa4d2d6b2bfb936a23be7
Summary:
@public
Further heap size reductions by using bitfields in `YGLayout` and `YGNode`.
Reviewed By: SidharthGuglani
Differential Revision: D13466325
fbshipit-source-id: ddcef0a1b3822e7449fe485d99c920d54139c893
Summary:
@public
Switches the storage in `facebook::yoga::detail::Values` from `YGValue` to `facebook::yoga::detail::CompactValue`.
This cuts heap size for arrays of values in half.
Reviewed By: SidharthGuglani
Differential Revision: D13465586
fbshipit-source-id: 49a4d6d29a73bdd44843b1f3c57bf746050c94d6
Summary:
@public
The storage format of `YGValue` in `YGStyle` is an implementation detail that is going to change soon. It is only guaranteed to be assignable from, and castable to `YGValue`.
Here, we remove tight coupling from the actual implementation in React Native.
Reviewed By: shergin
Differential Revision: D13465113
fbshipit-source-id: 41dfcb90c2a1cd825a6732854bf84d4c3318d835
Summary:
@public
When switching to `CompactValue`, casting edges or dimensions to `std::array<YGValue, ...>` will do actual work.
In order to avoid that from happening implicitely, we remove the casting operator.
Reviewed By: SidharthGuglani
Differential Revision: D13464292
fbshipit-source-id: 217065b001a63cfa8adde715063682c583007a4d
Summary:
@public
Enforce more encapsulation of arrays of `YGValue` in `YGSty;e`.
This will allow us to use `CompactValue` in `YGStyle` while (mostly) retaining API compatibility.
Reviewed By: SidharthGuglani
Differential Revision: D13452042
fbshipit-source-id: 382b1c7245c4bea4280126ab1413e7e931b62eaa
Summary:
@public
`CompactValue` represents a `YGValue` in 32bits instead of 64. This comes at the cost of a range limitation, as one exponent bit is borrowed for the unit.
*Undefined* and *Auto* have no magnitude, and are represented as *NaN* values.
The data structure is meant to be used as a field type on `YGStyle` to save memory.
This is header-only for efficient inlining.
Reviewed By: jackerghan, aCorrado
Differential Revision: D13187211
fbshipit-source-id: 16e3ffad592e38e2493e4f7c8b952d372e449846
Summary:
This diff fixes a style property that was incorrectly mapped as `textDecorationLineType` in Fabric
This was correctly mapped in classic here: diffusion/FBS/browse/master/xplat/js/react-native-github/Libraries/Text/BaseText/RCTBaseTextViewManager.m;10b92f1847cdec8a3f0a996f218989766516f805$48
Reviewed By: mdvacca
Differential Revision: D13443921
fbshipit-source-id: 7fafaf2492d8c3b938f2e433a983303958e5c578
Summary:
@public
removes the `default` case from an already exhaustive switch.
Reviewed By: SidharthGuglani
Differential Revision: D13451869
fbshipit-source-id: 32727330c7fce013963f5c83c95a73b230d5c938
Summary:
@public
Replaces the `StyleProp` template with a simple setter macro / inlined getter code.
The template was introduced to replace more extensive macros that would generate function signatures, too.
Here, we keep the spirit of that change by only generating function bodies.
Reviewed By: SidharthGuglani
Differential Revision: D13439612
fbshipit-source-id: 36f6a86917d035be6891cb736d1f288d8e02f5cf
Summary:
@public
`YGFloatOptional` is a 32bit type now, and can be passed by value efficiently.
Reviewed By: SidharthGuglani
Differential Revision: D13439603
fbshipit-source-id: e12539ad5b3cccbd5bc27869866ca66c023b24a7
Summary:
@public
Replace `YGFloatOptional::getValue()` with `YGFloatOptional::unwrap()`.
`YGFloatOptional::getValue()` has the unfortunate property of calling `std::exit` if the wrapped value is undefined.
Here, we eliminate the method, and just call `.unwrap()` everywhere.
Reviewed By: shergin
Differential Revision: D13439608
fbshipit-source-id: 5ae82b170537d0a10c301412567a7a66fd50bab4
Summary:
Replaces `YGUnwrapFloatOptional` with `YGFloatOptional::unwrap`.
This leads to more idiomatic C++, and to less function call nesting, thus increasing readability.
Reviewed By: SidharthGuglani
Differential Revision: D13439604
fbshipit-source-id: 33b43c08d725c253c359959e7cbbd83fd6bd9ba4
Summary:
@public
After removing `-ffast-math`, `NaN` can again be used to represent `undefined`. That allows us to remove the additional flag from `YGFloatOptional`, and reduce memory usage.
Reviewed By: SidharthGuglani
Differential Revision: D13439611
fbshipit-source-id: 93e90f72f0415edb228b4e7d145e1fae35cc6b43
Summary:
@public
Creates a single header file for `YGValue`. This is in preparation of a more compact representation of `YGValue` within `YGStyle`.
Also fixes the incorrect definition of NAN.
Reviewed By: SidharthGuglani
Differential Revision: D13439602
fbshipit-source-id: 68eef2c391b6c9810f3c995b86fff7204ebe6511
Summary:
@public
`-ffast-math` does not have measurable performance benefits.
By using `NaN` for *undefined* values again, we can squeeze `YGFloatOptional` into 32 bits.
This will also enable us to store `YGValue` (or a variant of it) in 32 bits.
Reviewed By: astreet
Differential Revision: D13403925
fbshipit-source-id: b13d026bf556f24ab4699e65fb450af13a70961b
Summary:
I've noticed that when a child's size is determined by `align-items: stretch` in combination with `aspect-ratio` its size is wrongly calculated to account for margin in the main axis when there is more than enough space.
See playground: https://goo.gl/tgW6cD
I've yet to figure out exactly how to solve this but i've started by writing a failing test when can be seen in the first commit here.
I assumed I had found the bug here https://github.com/facebook/yoga/blob/master/yoga/Yoga.cpp#L1838 where margin is being subtracted from the desired width even though the measure mode tells it to measure to exactly that size. However, if we don't remove this margin from the available width then 15 tests fail (including the one I just added) not quite figured out why yet. I'm also a bit confused at to why this would only happen for nodes with `aspect-ratio` and not for nodes where an explicit height and width is set.
Pull Request resolved: https://github.com/facebook/yoga/pull/834
Reviewed By: astreet
Differential Revision: D13223579
Pulled By: davidaurelio
fbshipit-source-id: 6970e6072e79f3bb6f9097355ab6e441441bfd88
Summary:
@public
Replaces the `StyleProp` template with a simple setter macro / inlined getter code.
The template was introduced to replace more extensive macros that would generate function signatures, too.
Here, we keep the spirit of that change by only generating function bodies.
Reviewed By: SidharthGuglani
Differential Revision: D13233687
fbshipit-source-id: 218a7d5edb489b43a66c8c9d6156f74feefd2227
Summary:
@public
`YGFloatOptional` is a 32bit type now, and can be passed by value efficiently.
Reviewed By: SidharthGuglani
Differential Revision: D13209150
fbshipit-source-id: c7b937a640258256c97e082ba2f832754e191b9a
Summary:
@public
`YGFloatOptional::getValue()` has the unfortunate property of calling `std::exit` if the wrapped value is undefined.
That forces `x.isUndefined() ? fallback : x.getValue()` as access pattern.
Here, we replace that by introducing `YGFloatOptional::orElse(float)` which encapsulates that pattern. Other additions are `orElseGet([] { … })` and some extra operators.
Reviewed By: SidharthGuglani
Differential Revision: D13209152
fbshipit-source-id: 4e5deceaaaaf8eaed44846a8c152cc8b235e815c
Summary:
@public
After removing `-ffast-math`, `NaN` can again be used to represent `undefined`. That allows us to remove the additional flag from `YGFloatOptional`, and reduce memory usage.
Reviewed By: SidharthGuglani
Differential Revision: D13209157
fbshipit-source-id: 21b83c837a78f924a4ec23a9236ca2440b3c8606
Summary:
@public
Creates a single header file for `YGValue`. This is in preparation of a more compact representation of `YGValue` within `YGStyle`.
Also fixes the incorrect definition of NAN.
Reviewed By: SidharthGuglani
Differential Revision: D13172444
fbshipit-source-id: 4250dbcf8fe15ec3ecdee3913360a73bab633ce3
Summary:
@public
`-ffast-math` does not have measurable performance benefits.
By using `NaN` for *undefined* values again, we can squeeze `YGFloatOptional` into 32 bits.
This will also enable us to store `YGValue` (or a variant of it) in 32 bits.
Reviewed By: SidharthGuglani
Differential Revision: D13119110
fbshipit-source-id: 4e6964240bf74ebc22d8783107b89d536a1a0842
Summary:
This check is too aggressive. We will consider putting it back once we are
more certain nothing will trigger it.
Differential Revision: D13350907
fbshipit-source-id: 6033bdbfe7adb2a18bdf889c090cf271497605e5
Summary:
In some setup, buck cxx test for android runs with `NDEBUG` set, hence we can't call debug symbols in the test cases. So guard those callsites with `#ifndef NDEBUG`.
Also, some dependencies for this test target depend on Android specific symbols, so we have to mark it as instrumentation test for now (FB-specific).
Reviewed By: sahrens
Differential Revision: D13337637
fbshipit-source-id: 02ff152df9937f2b0b8596f53789cdee8ee8a539
Summary: For configuration purpose, pass down config object from the hosting app and use it in UITemplateProcessor.
Reviewed By: sahrens
Differential Revision: D13290322
fbshipit-source-id: 8bb6d7f5a3f977b873e548e15603259876b46dc8
Summary: Each app may provide different impl for its runtime specific behaviors, then Fabric and other new infra can share the same config instance to configure stuffs.
Reviewed By: sahrens
Differential Revision: D13290319
fbshipit-source-id: 30e3eeedc6ff6ef250ed233b27e38cb7c1062b55
Summary: It was made dead by the previous revisions
Reviewed By: amnn
Differential Revision: D13313263
fbshipit-source-id: b8c8402b5427dc5d3efbbd2ee871aebf1e14ee0d
Summary:
In the version of JSC on iOS 11, creating a JSContext on one
thread and using it on another can trigger subtle and nearly
impossible to debug reentrancy-related crashes in the VM (see
https://bugs.webkit.org/show_bug.cgi?id=186827). In !NDEBUG builds,
check for this case and throw an exception, so it can be detected
early.
Reviewed By: amnn
Differential Revision: D13313264
fbshipit-source-id: ee85435c20e23c8520495ce743d2f91f2eeada5c
Summary:
`ShadowTree` class is already thread-safe, so we don't need to (we should not) guard concurent access to it.
We should guard concurrent write-access to the collection of them though.
Note that unordered_map is "thread-compatible" collection, so concurrent reading access is okay.
Reviewed By: mdvacca
Differential Revision: D13269745
fbshipit-source-id: 4779626018da0e42b81a835e538f6c1d1a8e25f7
Summary: Trivial diff that cleans up measure function in C++ and Android
Reviewed By: shergin
Differential Revision: D13200340
fbshipit-source-id: 6c0888439640241cdedf514898a1ba3dac231d6a
Summary:
`JSBigString` is using functions from `unistd.h`, like `getpagesize`, `dup`, `open`, etc. but was not directly including it.
It was being included from inside the glog `logging.h` header, which in turn was getting included by the Folly headers `JSBigString` was using.
This was discovered while building CxxReact with a custom shimmed Glog.
Pull Request resolved: https://github.com/facebook/react-native/pull/22330
Differential Revision: D13115346
Pulled By: shergin
fbshipit-source-id: 9fe4e3b28f74c0ca351ac6308484e375eace4db4
Summary:
The reasoning behind this change is that right now, having both added and modified modules inside of a single `modules` field doesn't allow for basic operations like combining two deltas.
For instance, say I have three different bundle revisions: A, B and C.
Module 42 was added in B, and then removed in C.
A->B = `{modules: [42, "..."], deleted: []}`
B->C = `{modules: [], deleted: [42]}`
A->C = `{modules: [], deleted: []}`
However, were we to compute A->C as the combination of A->B and B->C, it would result in `{modules: [], deleted: [42]}` because we have no way of knowing that module 42 was only just added in B.
This means that the `deleted` field of delta X->Y might eventually contain module ids that were never present in revision X, because they were added and then removed between revisions X and Y.
The last time I changed the delta format, we had a few bug reports pop out from people who had desync issues between their version of React Native and their version of Metro. As such, I've tried to make this change backwards compatible in at least one direction (new RN, old Metro). However, this will still break if someone is using a newer version of Metro and an older version of RN. I created T37123645 to follow up on this.
Reviewed By: rafeca, fromcelticpark
Differential Revision: D13156514
fbshipit-source-id: 4a4ee3b6cc0cdff5dca7368a46d7bf663769e281
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `TouchEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123042
fbshipit-source-id: 594b89b6e3986d6a04846194701e3a727b152cec
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `ScrollViewEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123049
fbshipit-source-id: 2839976d0119c48fa2538dbaa53afbc24982c598
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in ViewEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123048
fbshipit-source-id: 3c323912d3e65b684f99df6cda99c785876164af
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in SwitchEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123046
fbshipit-source-id: f2e4905a96191540ceec633bae1871c93be724db
Summary:
Now the event delive pipeline supports `JSI::Value`-based payload. Instead of passing `folly::dynamic`, now we are passing `std::function<jsi::Value(jsi::Runtime &runtime)>` as factory that can build a `JSI::Value` with given `jsi::Runtime` and any captured data.
The old (now legacy) way of calling `EventEmitter::dispatchEvent(..., const folly::dynamic &payload, ...)` is also supported.
Reviewed By: sahrens
Differential Revision: D13123043
fbshipit-source-id: d65348bb215013042abb2fcfe5083a8c697333d0
Summary: Now instead of passing `reactTag` through the whole event pipeline, we store it inside `EventTargetWrapper` (and it does not leave `UIManagerBinding`). It helps with reducing the complexity of `EventEmitter` and will help us in migrating to JSI.
Reviewed By: sahrens
Differential Revision: D13123045
fbshipit-source-id: aa9ee94d5660ff3090369c1e55cf748d2e72b987