cxxreact/RAMBundleRegistry: prepend segment ID

Reviewed By: fromcelticpark

Differential Revision: D7594348

fbshipit-source-id: 0b433de8722f8a952fd056139a350dc481f0af38
This commit is contained in:
Jean Lauliac 2018-04-17 11:54:47 -07:00 committed by Facebook Github Bot
parent e4f88c66e3
commit c9094e952b
1 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,7 @@
#include "RAMBundleRegistry.h"
#include <folly/Memory.h>
#include <folly/String.h>
#include <libgen.h>
@ -42,7 +43,14 @@ JSModulesUnbundle::Module RAMBundleRegistry::getModule(uint32_t bundleId, uint32
m_bundles.emplace(bundleId, m_factory(bundlePath->second));
}
return getBundle(bundleId)->getModule(moduleId);
auto module = getBundle(bundleId)->getModule(moduleId);
if (bundleId == MAIN_BUNDLE_ID) {
return module;
}
return {
folly::to<std::string>("seg-", bundleId, '_', std::move(module.name)),
std::move(module.code),
};
}
JSModulesUnbundle *RAMBundleRegistry::getBundle(uint32_t bundleId) const {