Skip to content

build backwards compat API for runtime pointer#43012

Closed
philIip wants to merge 2 commits into
react:mainfrom
philIip:export-D53646413
Closed

build backwards compat API for runtime pointer#43012
philIip wants to merge 2 commits into
react:mainfrom
philIip:export-D53646413

Conversation

@philIip

@philIip philIip commented Feb 14, 2024

Copy link
Copy Markdown
Contributor

Summary:
Changelog: [iOS][Added]

This introduces the backwards-compat functionality to give access to the jsi::Runtime in iOS in bridgeless. In bridge, this value is a private selector on RCTBridge that is exposed via category. We build this into the backwards compatible RCTBridgeProxy here.

This should work out of the box in bridgeless if you are already retrieveing the pointer via the bridge. However, we recommend users to eventually migrate towards C++ TurboModule or the RuntimeExecutor if possible. This will be removed in the future.

Differential Revision: D53646413

@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 labels Feb 14, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@analysis-bot

analysis-bot commented Feb 14, 2024

Copy link
Copy Markdown
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,828,333 +5
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,186,800 -9
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 1c4ed12
Branch: main

@tsapeta tsapeta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for implementing this even though it's going to be a temporary solution!
I think you'll also need to update RCTBridgeProxy initialization in RCTInstance.mm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not jsi::Runtime * for clarity?

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

Summary:
Changelog: [Android][Added]

This is a pre-deprecated API to give access to the jsi::Runtime in Android in bridgeless. In bridge, this value is exposed via the ReactContext, but is not implemented in the BridgelessReactContext. We do that here.

This should work out of the box in bridgeless if you are already retrieveing the pointer via ReactContext. However, we recommend users to eventually migrate towards C++ TurboModule or the RuntimeExecutor if possible. This will be removed in the future.

Reviewed By: RSNara

Differential Revision: D53645247
Summary:
Changelog: [iOS][Added]

This implements the functionality to give access to the jsi::Runtime in iOS in bridgeless. In bridge, this value is a private selector on RCTBridge that is exposed via category. We build this into the backwards compatible RCTBridgeProxy here.

This should work out of the box in bridgeless if you are already retrieveing the pointer via the bridge. However, we recommend users to eventually migrate towards C++ TurboModule or the RuntimeExecutor if possible. This will be removed in the future.

Reviewed By: RSNara

Differential Revision: D53646413
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 16276ce.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 15, 2024
{
[self logWarning:@"This method is unsupported. Returning nullptr." cmd:_cmd];
return nullptr;
[self logWarning:@"Please migrate to C++ TurboModule or RuntimeExecutor." cmd:_cmd];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any docs for RuntimeExecutor? How would one create a native C++ module that has access to jsi::Runtime and gets auto-linked/initialized properly on Android and iOS?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants