Back out "Fix: Install Fabric UIManager before main bundle execution"

Summary:
Original commit changeset: 4491d6de1109

Original Phabricator Diff: D39493654 (447be62909)

changelog: [internal]

Reviewed By: javache

Differential Revision: D39727129

fbshipit-source-id: 412a7fc5e4bf8db26cde7d420e71cf1f314cdc93
This commit is contained in:
Samuel Susla 2022-09-22 06:36:59 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 22940e4177
Коммит 15dbd9121d
6 изменённых файлов: 3 добавлений и 22 удалений

Просмотреть файл

@ -28,8 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface RCTSurfacePresenter : NSObject
- (instancetype)initWithContextContainer:(facebook::react::ContextContainer::Shared)contextContainer
runtimeExecutor:(facebook::react::RuntimeExecutor)runtimeExecutor
bindingsInstallExecutor:(facebook::react::RuntimeExecutor)bindingsInstallExecutor;
runtimeExecutor:(facebook::react::RuntimeExecutor)runtimeExecutor;
@property (nonatomic) facebook::react::ContextContainer::Shared contextContainer;
@property (nonatomic) facebook::react::RuntimeExecutor runtimeExecutor;

Просмотреть файл

@ -79,7 +79,6 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
RCTScheduler *_Nullable _scheduler; // Thread-safe. Pointer is protected by `_schedulerAccessMutex`.
ContextContainer::Shared _contextContainer; // Protected by `_schedulerLifeCycleMutex`.
RuntimeExecutor _runtimeExecutor; // Protected by `_schedulerLifeCycleMutex`.
RuntimeExecutor _bindingsInstallExecutor; // Only used for installing bindings.
butter::shared_mutex _observerListMutex;
std::vector<__weak id<RCTSurfacePresenterObserver>> _observers; // Protected by `_observerListMutex`.
@ -87,12 +86,10 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
- (instancetype)initWithContextContainer:(ContextContainer::Shared)contextContainer
runtimeExecutor:(RuntimeExecutor)runtimeExecutor
bindingsInstallExecutor:(RuntimeExecutor)bindingsInstallExecutor
{
if (self = [super init]) {
assert(contextContainer && "RuntimeExecutor must be not null.");
_runtimeExecutor = runtimeExecutor;
_bindingsInstallExecutor = bindingsInstallExecutor;
_contextContainer = contextContainer;
_surfaceRegistry = [RCTSurfaceRegistry new];
@ -298,7 +295,6 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
}
toolbox.runtimeExecutor = runtimeExecutor;
toolbox.bindingsInstallExecutor = _bindingsInstallExecutor;
toolbox.mainRunLoopObserverFactory = [](RunLoopObserver::Activity activities,
RunLoopObserver::WeakOwner const &owner) {

Просмотреть файл

@ -89,10 +89,8 @@ RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge)
{
if (self = [super init]) {
contextContainer->update(*RCTContextContainerFromBridge(bridge));
auto runtimeExecuter = RCTRuntimeExecutorFromBridge(bridge);
_surfacePresenter = [[RCTSurfacePresenter alloc] initWithContextContainer:contextContainer
runtimeExecutor:runtimeExecuter
bindingsInstallExecutor:runtimeExecuter];
runtimeExecutor:RCTRuntimeExecutorFromBridge(bridge)];
_bridge = bridge;
_batchedBridge = [_bridge batchedBridge] ?: _bridge;

Просмотреть файл

@ -468,12 +468,7 @@ void Binding::installFabricUIManager(
auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;
// TODO: (T130208323) runtimeExecutor should execute lambdas after
// main bundle eval, and bindingsInstallExecutor should execute before.
toolbox.bindingsInstallExecutor = runtimeExecutor;
toolbox.runtimeExecutor = runtimeExecutor;
toolbox.synchronousEventBeatFactory = synchronousBeatFactory;
toolbox.asynchronousEventBeatFactory = asynchronousBeatFactory;

Просмотреть файл

@ -95,7 +95,7 @@ Scheduler::Scheduler(
uiManager->setDelegate(this);
uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_);
schedulerToolbox.bindingsInstallExecutor([uiManager](jsi::Runtime &runtime) {
runtimeExecutor_([uiManager](jsi::Runtime &runtime) {
UIManagerBinding::createAndInstallIfNeeded(runtime, uiManager);
});

Просмотреть файл

@ -40,13 +40,6 @@ struct SchedulerToolbox final {
/*
* Represents running JavaScript VM and associated execution queue.
* Can execute lambdas before main bundle has loaded.
*/
RuntimeExecutor bindingsInstallExecutor;
/*
* Represents running JavaScript VM and associated execution queue.
* Only executes lambdas after main bundle has loaded.
*/
RuntimeExecutor runtimeExecutor;