diff --git a/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ReactCommon/cxxreact/NativeToJsBridge.cpp index 64b0673423b..be11a075f97 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -8,6 +8,7 @@ #include "NativeToJsBridge.h" #include +#include #include #include #include @@ -55,10 +56,14 @@ class JsToNativeBridge : public react::ExecutorDelegate { m_batchHadNativeModuleOrTurboModuleCalls = m_batchHadNativeModuleOrTurboModuleCalls || !calls.empty(); + std::vector methodCalls = parseMethodCalls(std::move(calls)); + NativeModulePerfLogger::getInstance().asyncMethodCallBatchPreprocessEnd( + (int)methodCalls.size()); + // An exception anywhere in here stops processing of the batch. This // was the behavior of the Android bridge, and since exception handling // terminates the whole bridge, there's not much point in continuing. - for (auto &call : parseMethodCalls(std::move(calls))) { + for (auto &call : methodCalls) { m_registry->callNativeMethod( call.moduleId, call.methodId, std::move(call.arguments), call.callId); } diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp index fd77eba63e6..6490e4d94c5 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp @@ -7,6 +7,7 @@ #include "jsireact/JSIExecutor.h" +#include #include #include #include @@ -383,6 +384,8 @@ void JSIExecutor::callNativeModules(const Value &queue, bool isEndOfBatch) { .getPropertyAsFunction(*runtime_, "stringify").call(*runtime_, queue) .getString(*runtime_).utf8(*runtime_); #endif + NativeModulePerfLogger::getInstance().asyncMethodCallBatchPreprocessStart(); + delegate_->callNativeModules( *this, dynamicFromValue(*runtime_, queue), isEndOfBatch); }