Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate TurboModuleManagerDelegate.getLegacyCxxModule #36667

Closed
wants to merge 5 commits into from

Conversation

RSNara
Copy link
Contributor

@RSNara RSNara commented Mar 27, 2023

Summary:

Context

TurboModuleManagerDelegate exposes two methods that create TurboModules:

  • TurboModule getModule()
  • CxxModuleWrapper getLegacyCxxModule()

Problem

TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

Changes

So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Mar 27, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44407802

@analysis-bot
Copy link

analysis-bot commented Mar 27, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,529,222 +9,650
android hermes armeabi-v7a 7,844,848 +9,070
android hermes x86 9,009,217 +10,489
android hermes x86_64 8,864,874 +9,975
android jsc arm64-v8a 9,150,505 +9,644
android jsc armeabi-v7a 8,342,054 +9,054
android jsc x86 9,205,034 +10,487
android jsc x86_64 9,463,604 +9,964

Base commit: 4e0dfed
Branch: main

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44407802

@RSNara RSNara force-pushed the export-D44407802 branch from 8f50f99 to 9d41630 Compare March 27, 2023 21:59
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44407802

@RSNara RSNara force-pushed the export-D44407802 branch from 9d41630 to ec0a2ad Compare March 28, 2023 14:05
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44407802

RSNara added a commit to RSNara/react-native that referenced this pull request Mar 28, 2023
Summary:
Pull Request resolved: facebook#36667

## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()

## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

fbshipit-source-id: 2ebaca6fbcaac6d8a67ea2ab3394be2f110f71ec
@RSNara RSNara force-pushed the export-D44407802 branch from ec0a2ad to 7c6a03d Compare March 28, 2023 14:11
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44407802

RSNara added a commit to RSNara/react-native that referenced this pull request Mar 28, 2023
Summary:
Pull Request resolved: facebook#36667

## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()

## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

fbshipit-source-id: 1cecca4ba3633d1d2b12f1611210be22ea637962
@RSNara RSNara force-pushed the export-D44407802 branch from 7c6a03d to 67b8487 Compare March 28, 2023 14:16
RSNara and others added 5 commits March 28, 2023 08:21
Summary:
In Bridgeless mode, With the TurboModule interop layer, the TurboModule system will need to customize the nativeModuleProxy global.

This customization would be much easier if the nativeModuleProxy global were installed by the TurboModule system (and not the Bridgeless core).

So, this diff moves nativeModuleProxy installation into the TurboModule system.

Changelog: [Internal]

Differential Revision: https://internalfb.com/D43993197

fbshipit-source-id: 300b77e84cf2df3fd6712f2788817b487a999001
Summary:
## Context
Previously, jsRepresentation would only cache the **HostFunctions** returned from TurboModule::createHostFunction().

## Changes
This diff replaces TurboModule::createHostFunction() with TurboModule::create().

Now, jsRepresentation will cache **all** the **properties** returned from TurboModule::create().

## Motivation
For interop modules, constants will be exported as properties on the TurboModule HostObject. This diff allows those constants (which are non HostFunctions) to be cached.

Changelog: [Internal]

Differential Revision: https://internalfb.com/D44253229

fbshipit-source-id: d5576b4d0d063035fe1cca2df582c4f5514fe6e7
Summary:
The legacy NativeModule system supports integer and float in NativeModule method arguments and returns. This diff extends the TurboModule system for the same functionality. T

his is necessary because the TurboModule system will now need to dispatch method calls to legacy NativeModules.

NOTE: We can't actually test these changes until we run interop modules.

Changelog: [Internal]

Differential Revision: https://internalfb.com/D44000389

fbshipit-source-id: c82fe05309334d9a60484a7ab9b6f7e3b26760e9
Summary:
The scope of TurboModuleManager is increasing:
- Eventually, it'll be capable of creating interop NativeModules (i.e: NativeModules that don't implement TurboModule).

So, instead of creating duplicate methods for NativeModules on the TurboModuleManager, this diff changes the APIs of TurboModuleManager to work with the NativeModule interface.

Thoughts?

## Questions
**Question:** Is this a breaking change for open source?
- Technically, yes. This diff changes the public interface of TurboModuleManager.

**Question:** How large of a thrash will this cause for open source apps?
- The thrash should be minimal. People in open source shouldn't be creating their own TurboModuleManager. They also shouldn't be directly accessing the TurboModuleManager object either.

**Question:** Is this change safe?
- Yeah. All the code that calls into TurboModuleRegistry converts TurboModules it returns into NativeModules.

**Question:** Is this change move us in the right direction?
- Long term, the TurboModule system will support legacy modules as well as TurboModules.
- I think it makes a lot of sense to have one Java-facing registry: after all, Java will just treat these NativeModules/TurboModules as regular Java objects, and call public methods on them. It doesn't care if the module is TurboModule-compatible or not.
- As for the TurboModuleRegistry abstraction, I think we should eventually rename this to NativeModuleRegistry after we delete the current NativeModuleRegistry.
- Still thinking about this though. I will leave this diff in review to welcome comments.

Changelog: [Android][Deprecated] - Deprecate TurboModuleRegistry.getModule(), getModules(), hasModule(),

Differential Revision: https://internalfb.com/D43801531

fbshipit-source-id: 76d7cc84c385d0c4e8fcaabfceb257e8690595bc
Summary:
Pull Request resolved: facebook#36667

## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()

## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

fbshipit-source-id: fc711c4682c9bdd303dfb2e94e68dc088f6cabb5
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44407802

@RSNara RSNara force-pushed the export-D44407802 branch from 67b8487 to b9f0431 Compare March 28, 2023 15:23
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 28, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 7a08fbb.

jeongshin pushed a commit to jeongshin/react-native that referenced this pull request May 7, 2023
Summary:
Pull Request resolved: facebook#36667

## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()

## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

fbshipit-source-id: 88a6cf6597db76d8a74fd777d68ccf4f43aa6811
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Pull Request resolved: facebook#36667

## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()

## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

fbshipit-source-id: 88a6cf6597db76d8a74fd777d68ccf4f43aa6811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner Platform: Android Android applications. Type: Deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants