Fabric: Scheduler-specific dependencies were moved to a separate class from ContextContainer

Summary: ContextContainer should contain only product/component-specific dependencies and stay unchanged during VM/Scheduler reloading.

Reviewed By: JoshuaGross

Differential Revision: D15636656

fbshipit-source-id: fe5de1b6c92f659b28d31eba901c04c5b23fe1d1
This commit is contained in:
Valentin Shergin
2019-06-07 12:03:57 -07:00
committed by Facebook Github Bot
parent 63ed75fe9e
commit a19cfc2273
8 changed files with 108 additions and 56 deletions
@@ -18,6 +18,7 @@
#include <react/uimanager/ComponentDescriptorFactory.h>
#include <react/uimanager/Scheduler.h>
#include <react/uimanager/SchedulerDelegate.h>
#include <react/uimanager/SchedulerToolbox.h>
#include <react/uimanager/primitives.h>
#include <react/utils/ContextContainer.h>
#include <react/utils/TimeUtils.h>
@@ -136,16 +137,15 @@ void Binding::installFabricUIManager(
std::shared_ptr<const ReactNativeConfig> config =
std::make_shared<const ReactNativeConfigHolder>(reactNativeConfig);
contextContainer->registerInstance(config, "ReactNativeConfig");
contextContainer->registerInstance<EventBeatFactory>(
synchronousBeatFactory, "synchronous");
contextContainer->registerInstance<EventBeatFactory>(
asynchronousBeatFactory, "asynchronous");
contextContainer->registerInstance(javaUIManager_, "FabricUIManager");
contextContainer->registerInstance(runtimeExecutor, "runtime-executor");
scheduler_ = std::make_shared<Scheduler>(
contextContainer, componentsRegistry->buildRegistryFunction);
auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;
toolbox.runtimeExecutor = runtimeExecutor;
toolbox.synchronousEventBeatFactory = synchronousBeatFactory;
toolbox.asynchronousEventBeatFactory = asynchronousBeatFactory;
scheduler_ = std::make_shared<Scheduler>(toolbox);
scheduler_->setDelegate(this);
}