mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-15 12:12:31 +08:00
Getting rid of File descriptor based loading APIs
Reviewed By: javache Differential Revision: D4333725 fbshipit-source-id: ba8591c7380e8eb90660a912f6fc86fc3d2d4774
This commit is contained in:
committed by
Facebook Github Bot
parent
b5f382c0e8
commit
8819bef56b
@@ -23,12 +23,15 @@ void JSExecutor::loadApplicationScript(std::string bundlePath, std::string sourc
|
||||
std::move(sourceURL));
|
||||
}
|
||||
|
||||
void JSExecutor::loadApplicationScript(int fd, std::string sourceURL) {
|
||||
std::unique_ptr<const JSBigFileString> JSBigFileString::fromPath(const std::string& sourceURL) {
|
||||
int fd = ::open(sourceURL.c_str(), O_RDONLY);
|
||||
folly::checkUnixError(fd, "Could not open file", sourceURL);
|
||||
SCOPE_EXIT { CHECK(::close(fd) == 0); };
|
||||
|
||||
struct stat fileInfo;
|
||||
folly::checkUnixError(::fstat(fd, &fileInfo), "fstat on bundle failed.");
|
||||
|
||||
auto bundle = folly::make_unique<JSBigFileString>(fd, fileInfo.st_size);
|
||||
return loadApplicationScript(std::move(bundle), std::move(sourceURL));
|
||||
return folly::make_unique<const JSBigFileString>(fd, fileInfo.st_size);
|
||||
}
|
||||
|
||||
static JSBigOptimizedBundleString::Encoding encodingFromByte(uint8_t byte) {
|
||||
|
||||
Reference in New Issue
Block a user