Deleting Optimized Bundle!

Reviewed By: javache

Differential Revision: D4566164

fbshipit-source-id: 1fbd3dd04f24399e93e3c6ec58956e6e18f1683f
This commit is contained in:
Ashok Menon
2017-02-16 13:24:44 -08:00
committed by Facebook Github Bot
parent 7c97008fa8
commit 14dc219810
13 changed files with 27 additions and 271 deletions

View File

@@ -343,65 +343,6 @@ static const char* explainLoadSourceStatus(JSLoadSourceStatus status) {
}
#endif
#ifdef WITH_FBJSCEXTENSIONS
void JSCExecutor::loadApplicationScript(
std::string bundlePath,
std::string sourceURL,
int flags) {
SystraceSection s("JSCExecutor::loadApplicationScript",
"sourceURL", sourceURL);
if (!(flags & (UNPACKED_JS_SOURCE | UNPACKED_BYTECODE))) {
throw RecoverableError("Optimized bundle with no unpacked source or bytecode");
}
String jsSourceURL(m_context, sourceURL.c_str());
JSSourceCodeRef sourceCode = nullptr;
SCOPE_EXIT {
if (sourceCode) {
JSReleaseSourceCode(sourceCode);
}
};
if (flags & UNPACKED_BYTECODE) {
int fd = open((bundlePath + UNPACKED_BYTECODE_SUFFIX).c_str(), O_RDONLY);
RecoverableError::runRethrowingAsRecoverable<std::system_error>([fd]() {
folly::checkUnixError(fd, "Couldn't open compiled bundle");
});
SCOPE_EXIT { close(fd); };
JSLoadSourceStatus jsStatus;
sourceCode = JSCreateCompiledSourceCode(fd, jsSourceURL, &jsStatus);
if (!sourceCode) {
throw RecoverableError(explainLoadSourceStatus(jsStatus));
}
} else {
auto jsScriptBigString = JSBigOptimizedBundleString::fromOptimizedBundle(bundlePath);
if (!jsScriptBigString->isAscii()) {
LOG(WARNING) << "Bundle is not ASCII encoded - falling back to the slow path";
return loadApplicationScript(std::move(jsScriptBigString), sourceURL);
}
sourceCode = JSCreateSourceCode(
jsScriptBigString->fd(),
jsSourceURL,
jsScriptBigString->hash(),
true);
}
ReactMarker::logMarker("RUN_JS_BUNDLE_START");
evaluateSourceCode(m_context, sourceCode, jsSourceURL);
bindBridge();
flush();
ReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
ReactMarker::logMarker("RUN_JS_BUNDLE_END");
}
#endif
void JSCExecutor::loadApplicationScript(std::unique_ptr<const JSBigString> script, std::string sourceURL) {
SystraceSection s("JSCExecutor::loadApplicationScript",
"sourceURL", sourceURL);