Remove unused RuntimeExecutor from UIManagerBinding constructor

Summary:
Changelog: [Internal] Remove unused RuntimeExecutor from UIManagerBinding constructor

Since [UIManager is the class that has a reference to RuntimeExecutor](https://github.com/facebook/react-native/blob/ce50c43986bae05ad62552be46f4d5bb4a46f097/ReactCommon/react/renderer/uimanager/UIManager.h#L35-L36), there's no reason for `UIManagerBinding` to own a reference to RuntimeExecutor too.

The purpose of `UIManagerBinding` is to bind the Fabric `std::shared_ptr<UIManager>` in C++ to `global.nativeFabricUIManager` in JS.

Doing this cleanup to make the next diff easier.

Reviewed By: sammy-SC

Differential Revision: D39490927

fbshipit-source-id: 4c393dccc6985bef44e3b0afc32b9f79bea25f80
This commit is contained in:
Paige Sun
2022-09-14 14:51:27 -07:00
committed by Facebook GitHub Bot
parent f44469076d
commit e2028a8cb8
3 changed files with 7 additions and 20 deletions
@@ -95,11 +95,9 @@ Scheduler::Scheduler(
uiManager->setDelegate(this);
uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_);
runtimeExecutor_(
[uiManager, runtimeExecutor = runtimeExecutor_](jsi::Runtime &runtime) {
UIManagerBinding::createAndInstallIfNeeded(
runtime, runtimeExecutor, uiManager);
});
runtimeExecutor_([uiManager](jsi::Runtime &runtime) {
UIManagerBinding::createAndInstallIfNeeded(runtime, uiManager);
});
auto componentDescriptorRegistryKey =
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE";
@@ -23,7 +23,6 @@ namespace facebook::react {
void UIManagerBinding::createAndInstallIfNeeded(
jsi::Runtime &runtime,
RuntimeExecutor const &runtimeExecutor,
std::shared_ptr<UIManager> const &uiManager) {
auto uiManagerModuleName = "nativeFabricUIManager";
@@ -32,8 +31,7 @@ void UIManagerBinding::createAndInstallIfNeeded(
if (uiManagerValue.isUndefined()) {
// The global namespace does not have an instance of the binding;
// we need to create, install and return it.
auto uiManagerBinding =
std::make_shared<UIManagerBinding>(uiManager, runtimeExecutor);
auto uiManagerBinding = std::make_shared<UIManagerBinding>(uiManager);
auto object = jsi::Object::createFromHostObject(runtime, uiManagerBinding);
runtime.global().setProperty(
runtime, uiManagerModuleName, std::move(object));
@@ -54,11 +52,8 @@ std::shared_ptr<UIManagerBinding> UIManagerBinding::getBinding(
return uiManagerObject.getHostObject<UIManagerBinding>(runtime);
}
UIManagerBinding::UIManagerBinding(
std::shared_ptr<UIManager> uiManager,
RuntimeExecutor runtimeExecutor)
: uiManager_(std::move(uiManager)),
runtimeExecutor_(std::move(runtimeExecutor)) {}
UIManagerBinding::UIManagerBinding(std::shared_ptr<UIManager> uiManager)
: uiManager_(std::move(uiManager)) {}
UIManagerBinding::~UIManagerBinding() {
LOG(WARNING) << "UIManagerBinding::~UIManagerBinding() was called (address: "
@@ -7,7 +7,6 @@
#pragma once
#include <ReactCommon/RuntimeExecutor.h>
#include <folly/dynamic.h>
#include <jsi/jsi.h>
#include <react/renderer/core/RawValue.h>
@@ -28,7 +27,6 @@ class UIManagerBinding : public jsi::HostObject {
*/
static void createAndInstallIfNeeded(
jsi::Runtime &runtime,
RuntimeExecutor const &runtimeExecutor,
std::shared_ptr<UIManager> const &uiManager);
/*
@@ -37,9 +35,7 @@ class UIManagerBinding : public jsi::HostObject {
*/
static std::shared_ptr<UIManagerBinding> getBinding(jsi::Runtime &runtime);
UIManagerBinding(
std::shared_ptr<UIManager> uiManager,
RuntimeExecutor runtimeExecutor);
UIManagerBinding(std::shared_ptr<UIManager> uiManager);
~UIManagerBinding();
@@ -76,8 +72,6 @@ class UIManagerBinding : public jsi::HostObject {
std::shared_ptr<UIManager> uiManager_;
std::unique_ptr<EventHandler const> eventHandler_;
mutable ReactEventPriority currentEventPriority_;
RuntimeExecutor runtimeExecutor_;
};
} // namespace facebook::react