From 5290047d09c0a41c85a1d47a638877c226d9c191 Mon Sep 17 00:00:00 2001 From: maschad Date: Sun, 15 Mar 2020 22:50:58 -0700 Subject: [PATCH] Make Lambda function called in NativeModule mutable to improve performance (#28297) Summary: Fixes https://github.com/facebook/react-native/issues/28271 As explained by mmallet-youilabs , if the parameters passed to the `move` function are too expensive, this can have an impact on performance. Thus making these parameters captured by value mutable, the parameters are not movable. ## Changelog [iOS] [Fixed] - Message Pull Request resolved: https://github.com/facebook/react-native/pull/28297 Test Plan: Steps to reproduce (and expected results) are not applicable (unless running with a profiler). Differential Revision: D20464278 Pulled By: shergin fbshipit-source-id: 846a8bc6c61cb4aa21fbd96b419c3775190a2c84 --- ReactCommon/cxxreact/CxxNativeModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/cxxreact/CxxNativeModule.cpp b/ReactCommon/cxxreact/CxxNativeModule.cpp index 94ab82bfe0b..0df2ed17e6d 100644 --- a/ReactCommon/cxxreact/CxxNativeModule.cpp +++ b/ReactCommon/cxxreact/CxxNativeModule.cpp @@ -148,7 +148,7 @@ void CxxNativeModule::invoke( // mhorowitz #7128529: convert C++ exceptions to Java messageQueueThread_->runOnQueue( - [method, params = std::move(params), first, second, callId]() { + [method, params = std::move(params), first, second, callId]() mutable { #ifdef WITH_FBSYSTRACE if (callId != -1) { fbsystrace_end_async_flow(TRACE_TAG_REACT_APPS, "native", callId);