mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
perf: Move func into CallInvoker::invokeAsync (#54141)
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 <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: https://github.com/facebook/react-native/pull/54141 Test Plan: Build, run. A lot of code still uses the old `invokeAsync` function. Reviewed By: christophpurrer Differential Revision: D84563949 Pulled By: javache fbshipit-source-id: 283be3d12f1ac1c7f3da528c6b50b36cc81cd82a
This commit is contained in:
committed by
meta-codesync[bot]
parent
6d7a93f2b1
commit
5ffff0153c
@@ -38,11 +38,11 @@ class CallInvoker {
|
||||
|
||||
// Backward compatibility only, prefer the CallFunc methods instead
|
||||
virtual void invokeAsync(std::function<void()>&& func) noexcept {
|
||||
invokeAsync([func](jsi::Runtime&) { func(); });
|
||||
invokeAsync([func = std::move(func)](jsi::Runtime&) { func(); });
|
||||
}
|
||||
|
||||
virtual void invokeSync(std::function<void()>&& func) {
|
||||
invokeSync([func](jsi::Runtime&) { func(); });
|
||||
invokeSync([func = std::move(func)](jsi::Runtime&) { func(); });
|
||||
}
|
||||
|
||||
virtual ~CallInvoker() = default;
|
||||
|
||||
Reference in New Issue
Block a user