Skip to content

Conversation

mrousavy
Copy link
Contributor

Summary:

Instead of copying the std::function into invokeAsync, we now move it.

Changelog:

[GENERAL] [CHANGED] - Move std::function into CallInvoker::invokeAsync instead of copying it

Test Plan:

Build, run. A lot of code still uses the old invokeAsync function.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 13, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 13, 2025
@mrousavy
Copy link
Contributor Author

mrousavy commented Oct 13, 2025

On another note; do you think we should mark the "old" invokeAsync/invokeSync functions [[deprecated]] and try to move everyone to the new functions?

Right now the old functions just schedule anything under SchedulerPriority::ImmediatePriority (the highest priority), which of course is sub-optimal for anyone else actually respecting the SchedulerPriority APIs.

Ideally the categories should be:

  • SchedulerPriority::IdlePriority:
    • ??
  • SchedulerPriority::LowPriority:
    • ??
  • SchedulerPriority::NormalPriority:
    • Async JS callbacks
  • SchedulerPriority::UserBlockingPriority
    • Promise resolve/reject
    • setTimeout
  • SchedulerPriority::ImmediatePriority
    • requestAnimationFrame

@javache
Copy link
Member

javache commented Oct 14, 2025

Thanks! Agree that it would make sense to deprecate the other variants, but we should probably improve docs first on what to use each priority for.

Copy link

meta-codesync bot commented Oct 14, 2025

@javache has imported this pull request. If you are a Meta employee, you can view this in D84563949.

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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants