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

Initialize the RuntimeScheduler and TurboModule bindings via RuntimeExecutor #12402

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rozele
Copy link
Collaborator

@rozele rozele commented Nov 15, 2023

Description

Type of Change

Erase all that don't apply.

  • New feature (non-breaking change which adds functionality)

Why

In order to minimize the dependency on the JSI runtime holder, this switches the initialization of TurboModules and RuntimeScheduler bindings to use the RuntimeExecutor, which hands us back the Runtime instance.

Testing

Ran Playground, TurboModules still appear to initialize correctly (or else the UIManager wouldn't be able to reload).

Changelog

Should this change be included in the release notes: no

Microsoft Reviewers: Open in CodeFlow

@rozele rozele requested a review from a team as a code owner November 15, 2023 23:25
@rozele rozele force-pushed the tmInitOnRuntimeExecutor branch from 11f936d to e4aedb9 Compare November 16, 2023 20:18
@rozele rozele force-pushed the tmInitOnRuntimeExecutor branch from e4aedb9 to 11d6898 Compare November 28, 2023 16:01
longLivedObjectCollection = m_longLivedObjectCollection]() {
// Use RuntimeExecutor so non-ABI JSExecutorFactory instances passed in through DevSettings
// can use the same logic
runtimeExecutor([propertyBag,
Copy link
Member

@vmoroz vmoroz Dec 2, 2023

Choose a reason for hiding this comment

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

Previously we ran this code synchronously.
As comment used to say that it enabled us to have the TurboModuleManager fully initialized by the time we exit the method.
This PR changes it to run asynchronously in a different thread. Thus, the TurboModuleManager maybe not initialized by the time we exit this method.
My concern is that this code may affect scenarios where we previously relied on the TurboModuleManager be initialized.

Should we run the runtimeExecutor synchronously here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This deadlocks when trying to run synchronously on the RuntimeExecutor, so I left it as async for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think perhaps we should do this conditionally. We can keep this "as is" if using ABI JSI, and switch to the async RuntimeExecutor only if using the non-ABI JSI option.

rozele added 2 commits January 4, 2024 11:31
…xecutor

In order to minimize the dependency on the JSI runtime holder, this
switches the initialization of TurboModules and RuntimeScheduler
bindings to use the RuntimeExecutor, which hands us back the Runtime
instance.
@rozele rozele force-pushed the tmInitOnRuntimeExecutor branch from 11d6898 to 39895bb Compare January 4, 2024 16:31
@chiaramooney chiaramooney requested a review from vmoroz January 31, 2024 23:34
@rozele rozele marked this pull request as draft March 29, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants