Delaying native module config collection.
Reviewed By: javache Differential Revision: D4436427 fbshipit-source-id: de91473471a097a94c003f16f488b6118b52d689
This commit is contained in:
parent
3b3d294a6b
commit
22bff6bbc0
|
@ -39,13 +39,22 @@ std::unique_ptr<JSExecutor> ProxyExecutorOneTimeFactory::createJSExecutor(
|
||||||
ProxyExecutor::ProxyExecutor(jni::global_ref<jobject>&& executorInstance,
|
ProxyExecutor::ProxyExecutor(jni::global_ref<jobject>&& executorInstance,
|
||||||
std::shared_ptr<ExecutorDelegate> delegate)
|
std::shared_ptr<ExecutorDelegate> delegate)
|
||||||
: m_executor(std::move(executorInstance))
|
: m_executor(std::move(executorInstance))
|
||||||
, m_delegate(delegate) {
|
, m_delegate(delegate)
|
||||||
|
{}
|
||||||
|
|
||||||
|
ProxyExecutor::~ProxyExecutor() {
|
||||||
|
m_executor.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProxyExecutor::loadApplicationScript(
|
||||||
|
std::unique_ptr<const JSBigString>,
|
||||||
|
std::string sourceURL) {
|
||||||
|
|
||||||
folly::dynamic nativeModuleConfig = folly::dynamic::array;
|
folly::dynamic nativeModuleConfig = folly::dynamic::array;
|
||||||
|
|
||||||
{
|
{
|
||||||
SystraceSection s("collectNativeModuleDescriptions");
|
SystraceSection s("collectNativeModuleDescriptions");
|
||||||
auto moduleRegistry = delegate->getModuleRegistry();
|
auto moduleRegistry = m_delegate->getModuleRegistry();
|
||||||
for (const auto& name : moduleRegistry->moduleNames()) {
|
for (const auto& name : moduleRegistry->moduleNames()) {
|
||||||
auto config = moduleRegistry->getConfig(name);
|
auto config = moduleRegistry->getConfig(name);
|
||||||
nativeModuleConfig.push_back(config ? config->config : nullptr);
|
nativeModuleConfig.push_back(config ? config->config : nullptr);
|
||||||
|
@ -56,19 +65,13 @@ ProxyExecutor::ProxyExecutor(jni::global_ref<jobject>&& executorInstance,
|
||||||
folly::dynamic::object
|
folly::dynamic::object
|
||||||
("remoteModuleConfig", std::move(nativeModuleConfig));
|
("remoteModuleConfig", std::move(nativeModuleConfig));
|
||||||
|
|
||||||
SystraceSection t("setGlobalVariable");
|
{
|
||||||
setGlobalVariable(
|
SystraceSection t("setGlobalVariable");
|
||||||
"__fbBatchedBridgeConfig",
|
setGlobalVariable(
|
||||||
folly::make_unique<JSBigStdString>(folly::toJson(config)));
|
"__fbBatchedBridgeConfig",
|
||||||
}
|
folly::make_unique<JSBigStdString>(folly::toJson(config)));
|
||||||
|
}
|
||||||
|
|
||||||
ProxyExecutor::~ProxyExecutor() {
|
|
||||||
m_executor.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProxyExecutor::loadApplicationScript(
|
|
||||||
std::unique_ptr<const JSBigString>,
|
|
||||||
std::string sourceURL) {
|
|
||||||
static auto loadApplicationScript =
|
static auto loadApplicationScript =
|
||||||
jni::findClassStatic(EXECUTOR_BASECLASS)->getMethod<void(jstring)>("loadApplicationScript");
|
jni::findClassStatic(EXECUTOR_BASECLASS)->getMethod<void(jstring)>("loadApplicationScript");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue