log script name with bundle loading perf event

Reviewed By: javache

Differential Revision: D5010638

fbshipit-source-id: 2e139201a8374245fa1dedc4f11a716dcf700fd7
This commit is contained in:
Ben Nham
2017-05-10 03:48:13 -07:00
committed by Facebook Github Bot
parent 5dcfb2c6ad
commit 65f22a5190
6 changed files with 32 additions and 9 deletions

View File

@@ -292,11 +292,18 @@ static const char* explainLoadSourceStatus(JSLoadSourceStatus status) {
}
#endif
// basename_r isn't in all iOS SDKs, so use this simple version instead.
static std::string simpleBasename(const std::string &path) {
size_t pos = path.rfind("/");
return (pos != std::string::npos) ? path.substr(pos) : path;
}
void JSCExecutor::loadApplicationScript(std::unique_ptr<const JSBigString> script, std::string sourceURL) {
SystraceSection s("JSCExecutor::loadApplicationScript",
"sourceURL", sourceURL);
ReactMarker::logMarker(ReactMarker::RUN_JS_BUNDLE_START);
std::string scriptName = simpleBasename(sourceURL);
ReactMarker::logTaggedMarker(ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
String jsSourceURL(m_context, sourceURL.c_str());
// TODO t15069155: reduce the number of overrides here