Skip to content

Conversation

@motiz88
Copy link
Contributor

@motiz88 motiz88 commented Mar 6, 2024

Summary:
Changelog: [Internal]

(Continuing the theme of reducing integration boilerplate from D54537844.)

This diff changes both JSExecutor (Bridge) and JSRuntime (Bridgeless) to no longer implement RuntimeTargetDelegate. Instead, each of them exposes a getRuntimeTargetDelegate() method that returns a stable reference to a target delegate that it owns.

To facilitate this, we create a new FallbackRuntimeTargetDelegate for use in non-Hermes cases. This replaces almost all direct uses of FallbackRuntimeAgentDelegate outside of jsinspector. I'll follow up in a separate diff to deal with the last case and make the fallback agent delegate fully private.

As a result, changing the RuntimeTargetDelegate interface (which we'll need to do for console support) becomes much easier: we only have unit test mocks + two concrete RuntimeTargetDelegate implementations (one fallback, one Hermes) to update for each API change.

Differential Revision: D54585658

@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 Mar 6, 2024
@facebook-github-bot
Copy link
Contributor

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

…ethods (facebook#43346)

Summary:

Changelog: [Internal]

(Continuing the theme of reducing integration boilerplate from D54537844.)

This diff changes both `JSExecutor` (Bridge) and `JSRuntime` (Bridgeless) to no longer implement `RuntimeTargetDelegate`. Instead, each of them exposes a `getRuntimeTargetDelegate()` method that returns a stable reference to a target delegate that it *owns*.

To facilitate this, we create a new `FallbackRuntimeTargetDelegate` for use in non-Hermes cases. This replaces *almost* all direct uses of `FallbackRuntimeAgentDelegate` outside of `jsinspector`. I'll follow up in a separate diff to deal with the last case and make the fallback agent delegate fully private.

As a result, changing the `RuntimeTargetDelegate` interface (which we'll need to do for console support) becomes much easier: we only have unit test mocks + two concrete `RuntimeTargetDelegate` implementations (one fallback, one Hermes) to update for each API change.

Differential Revision: D54585658
@motiz88 motiz88 force-pushed the export-D54585658 branch from eb5fdb5 to 24c361f Compare March 6, 2024 15:14
@facebook-github-bot
Copy link
Contributor

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

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 18,008,350 -13
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,366,878 -5
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 1c69100
Branch: main

motiz88 added a commit to motiz88/react-native that referenced this pull request Mar 6, 2024
…ethods (facebook#43346)

Summary:

Changelog: [Internal]

(Continuing the theme of reducing integration boilerplate from D54537844.)

This diff changes both `JSExecutor` (Bridge) and `JSRuntime` (Bridgeless) to no longer implement `RuntimeTargetDelegate`. Instead, each of them exposes a `getRuntimeTargetDelegate()` method that returns a stable reference to a target delegate that it *owns*.

To facilitate this, we create a new `FallbackRuntimeTargetDelegate` for use in non-Hermes cases. This replaces *almost* all direct uses of `FallbackRuntimeAgentDelegate` outside of `jsinspector`. I'll follow up in a separate diff to deal with the last case and make the fallback agent delegate fully private.

As a result, changing the `RuntimeTargetDelegate` interface (which we'll need to do for console support) becomes much easier: we only have unit test mocks + two concrete `RuntimeTargetDelegate` implementations (one fallback, one Hermes) to update for each API change.

Differential Revision: D54585658
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 11, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 7c5a014.

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.

3 participants