Skip to content

Commit e2028a8

Browse files
p-sunfacebook-github-bot
authored andcommitted
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
1 parent f444690 commit e2028a8

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

ReactCommon/react/renderer/scheduler/Scheduler.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ Scheduler::Scheduler(
9595
uiManager->setDelegate(this);
9696
uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_);
9797

98-
runtimeExecutor_(
99-
[uiManager, runtimeExecutor = runtimeExecutor_](jsi::Runtime &runtime) {
100-
UIManagerBinding::createAndInstallIfNeeded(
101-
runtime, runtimeExecutor, uiManager);
102-
});
98+
runtimeExecutor_([uiManager](jsi::Runtime &runtime) {
99+
UIManagerBinding::createAndInstallIfNeeded(runtime, uiManager);
100+
});
103101

104102
auto componentDescriptorRegistryKey =
105103
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE";

ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ namespace facebook::react {
2323

2424
void UIManagerBinding::createAndInstallIfNeeded(
2525
jsi::Runtime &runtime,
26-
RuntimeExecutor const &runtimeExecutor,
2726
std::shared_ptr<UIManager> const &uiManager) {
2827
auto uiManagerModuleName = "nativeFabricUIManager";
2928

@@ -32,8 +31,7 @@ void UIManagerBinding::createAndInstallIfNeeded(
3231
if (uiManagerValue.isUndefined()) {
3332
// The global namespace does not have an instance of the binding;
3433
// we need to create, install and return it.
35-
auto uiManagerBinding =
36-
std::make_shared<UIManagerBinding>(uiManager, runtimeExecutor);
34+
auto uiManagerBinding = std::make_shared<UIManagerBinding>(uiManager);
3735
auto object = jsi::Object::createFromHostObject(runtime, uiManagerBinding);
3836
runtime.global().setProperty(
3937
runtime, uiManagerModuleName, std::move(object));
@@ -54,11 +52,8 @@ std::shared_ptr<UIManagerBinding> UIManagerBinding::getBinding(
5452
return uiManagerObject.getHostObject<UIManagerBinding>(runtime);
5553
}
5654

57-
UIManagerBinding::UIManagerBinding(
58-
std::shared_ptr<UIManager> uiManager,
59-
RuntimeExecutor runtimeExecutor)
60-
: uiManager_(std::move(uiManager)),
61-
runtimeExecutor_(std::move(runtimeExecutor)) {}
55+
UIManagerBinding::UIManagerBinding(std::shared_ptr<UIManager> uiManager)
56+
: uiManager_(std::move(uiManager)) {}
6257

6358
UIManagerBinding::~UIManagerBinding() {
6459
LOG(WARNING) << "UIManagerBinding::~UIManagerBinding() was called (address: "

ReactCommon/react/renderer/uimanager/UIManagerBinding.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#pragma once
99

10-
#include <ReactCommon/RuntimeExecutor.h>
1110
#include <folly/dynamic.h>
1211
#include <jsi/jsi.h>
1312
#include <react/renderer/core/RawValue.h>
@@ -28,7 +27,6 @@ class UIManagerBinding : public jsi::HostObject {
2827
*/
2928
static void createAndInstallIfNeeded(
3029
jsi::Runtime &runtime,
31-
RuntimeExecutor const &runtimeExecutor,
3230
std::shared_ptr<UIManager> const &uiManager);
3331

3432
/*
@@ -37,9 +35,7 @@ class UIManagerBinding : public jsi::HostObject {
3735
*/
3836
static std::shared_ptr<UIManagerBinding> getBinding(jsi::Runtime &runtime);
3937

40-
UIManagerBinding(
41-
std::shared_ptr<UIManager> uiManager,
42-
RuntimeExecutor runtimeExecutor);
38+
UIManagerBinding(std::shared_ptr<UIManager> uiManager);
4339

4440
~UIManagerBinding();
4541

@@ -76,8 +72,6 @@ class UIManagerBinding : public jsi::HostObject {
7672
std::shared_ptr<UIManager> uiManager_;
7773
std::unique_ptr<EventHandler const> eventHandler_;
7874
mutable ReactEventPriority currentEventPriority_;
79-
80-
RuntimeExecutor runtimeExecutor_;
8175
};
8276

8377
} // namespace facebook::react

0 commit comments

Comments
 (0)