add marker surrounding entire native module creation

Reviewed By: javache

Differential Revision: D5200856

fbshipit-source-id: 35b0e627224d518126a1cfdd36d6af264dd186cf
This commit is contained in:
Ben Nham
2017-06-09 06:11:43 -07:00
committed by Facebook Github Bot
parent 80bc07fd60
commit 2984628357
5 changed files with 21 additions and 1 deletions

View File

@@ -4,6 +4,8 @@
#include <string>
#include "Platform.h"
namespace facebook {
namespace react {
@@ -41,6 +43,8 @@ void JSCNativeModules::reset() {
}
folly::Optional<Object> JSCNativeModules::createModule(const std::string& name, JSContextRef context) {
ReactMarker::logTaggedMarker(ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str());
if (!m_genNativeModuleJS) {
auto global = Object::getGlobalObject(context);
m_genNativeModuleJS = global.getProperty("__fbGenNativeModule").asObject();
@@ -58,7 +62,11 @@ folly::Optional<Object> JSCNativeModules::createModule(const std::string& name,
});
CHECK(!moduleInfo.isNull()) << "Module returned from genNativeModule is null";
return moduleInfo.asObject().getProperty("module").asObject();
folly::Optional<Object> module(moduleInfo.asObject().getProperty("module").asObject());
ReactMarker::logTaggedMarker(ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str());
return module;
}
} }