Permalink
Browse files

add marker surrounding entire native module creation

Reviewed By: javache

Differential Revision: D5200856

fbshipit-source-id: 35b0e627224d518126a1cfdd36d6af264dd186cf
  • Loading branch information...
bnham authored and facebook-github-bot committed Jun 9, 2017
1 parent 80bc07f commit 29846283579a35abdd6a5e236c747736563fa200
@@ -97,6 +97,8 @@ static void registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogg
case ReactMarker::CREATE_REACT_CONTEXT_STOP:
case ReactMarker::JS_BUNDLE_STRING_CONVERT_START:
case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP:
case ReactMarker::NATIVE_MODULE_SETUP_START:
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
// These are not used on iOS.
break;
}
@@ -28,6 +28,8 @@
CREATE_VIEW_MANAGERS_END,
CREATE_UI_MANAGER_MODULE_CONSTANTS_START,
CREATE_UI_MANAGER_MODULE_CONSTANTS_END,
NATIVE_MODULE_SETUP_START,
NATIVE_MODULE_SETUP_END,
CREATE_MODULE_START,
CREATE_MODULE_END,
PROCESS_CORE_REACT_PACKAGE_START,
@@ -139,6 +139,12 @@ static void logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char*
case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP:
JReactMarker::logMarker("loadApplicationScript_endStringConvert");
break;
case ReactMarker::NATIVE_MODULE_SETUP_START:
JReactMarker::logMarker("NATIVE_MODULE_SETUP_START", tag);
break;
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
JReactMarker::logMarker("NATIVE_MODULE_SETUP_END", tag);
break;
case ReactMarker::NATIVE_REQUIRE_START:
case ReactMarker::NATIVE_REQUIRE_STOP:
// These are not used on Android.
@@ -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;
}
} }
@@ -23,6 +23,8 @@ enum ReactMarkerId {
CREATE_REACT_CONTEXT_STOP,
JS_BUNDLE_STRING_CONVERT_START,
JS_BUNDLE_STRING_CONVERT_STOP,
NATIVE_MODULE_SETUP_START,
NATIVE_MODULE_SETUP_STOP,
};
using LogTaggedMarker = std::function<void(const ReactMarkerId, const char* tag)>;

0 comments on commit 2984628

Please sign in to comment.