Remove a bunch of copies

Reviewed By: astreet

Differential Revision: D3475592

fbshipit-source-id: 37148bb8d8d47e9301ad549b183029337f7c4ca0
This commit is contained in:
Alexander Blom
2016-07-07 09:00:01 -07:00
committed by Facebook Github Bot 1
parent 95401aba72
commit be0abd17e5
5 changed files with 17 additions and 18 deletions
+8 -9
View File
@@ -143,14 +143,14 @@ void NativeToJsBridge::loadApplicationUnbundle(
void NativeToJsBridge::callFunction(
ExecutorToken executorToken,
const std::string& moduleId,
const std::string& methodId,
const folly::dynamic& arguments) {
std::string&& module,
std::string&& method,
folly::dynamic&& arguments) {
int systraceCookie = -1;
#ifdef WITH_FBSYSTRACE
systraceCookie = m_systraceCookie++;
std::string tracingName = fbsystrace_is_tracing(TRACE_TAG_REACT_CXX_BRIDGE) ?
folly::to<std::string>("JSCall__", moduleId, '_', methodId) : std::string();
folly::to<std::string>("JSCall__", module, '_', method) : std::string();
SystraceSection s(tracingName.c_str());
FbSystraceAsyncFlow::begin(
TRACE_TAG_REACT_CXX_BRIDGE,
@@ -160,7 +160,7 @@ void NativeToJsBridge::callFunction(
std::string tracingName;
#endif
runOnExecutorQueue(executorToken, [moduleId, methodId, arguments, tracingName = std::move(tracingName), systraceCookie] (JSExecutor* executor) {
runOnExecutorQueue(executorToken, [module = std::move(module), method = std::move(method), arguments = std::move(arguments), tracingName = std::move(tracingName), systraceCookie] (JSExecutor* executor) {
#ifdef WITH_FBSYSTRACE
FbSystraceAsyncFlow::end(
TRACE_TAG_REACT_CXX_BRIDGE,
@@ -172,12 +172,11 @@ void NativeToJsBridge::callFunction(
// This is safe because we are running on the executor's thread: it won't
// destruct until after it's been unregistered (which we check above) and
// that will happen on this thread
executor->callFunction(moduleId, methodId, arguments);
executor->callFunction(module, method, arguments);
});
}
void NativeToJsBridge::invokeCallback(ExecutorToken executorToken, const double callbackId,
const folly::dynamic& arguments) {
void NativeToJsBridge::invokeCallback(ExecutorToken executorToken, double callbackId, folly::dynamic&& arguments) {
int systraceCookie = -1;
#ifdef WITH_FBSYSTRACE
systraceCookie = m_systraceCookie++;
@@ -187,7 +186,7 @@ void NativeToJsBridge::invokeCallback(ExecutorToken executorToken, const double
systraceCookie);
#endif
runOnExecutorQueue(executorToken, [callbackId, arguments, systraceCookie] (JSExecutor* executor) {
runOnExecutorQueue(executorToken, [callbackId, arguments = std::move(arguments), systraceCookie] (JSExecutor* executor) {
#ifdef WITH_FBSYSTRACE
FbSystraceAsyncFlow::end(
TRACE_TAG_REACT_CXX_BRIDGE,