mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
move reference to RuntimeScheduler to pointer (#47605)
Some checks failed
Label closed PR as merged and leave a comment / comment-and-label (push) Waiting to run
Publish Bumped Packages / publish_bumped_packages (push) Waiting to run
Update node modules cache / update_node_modules_cache (push) Waiting to run
Keep Github Actions Cache < 10GB / cache-cleaner (push) Has been cancelled
Some checks failed
Label closed PR as merged and leave a comment / comment-and-label (push) Waiting to run
Publish Bumped Packages / publish_bumped_packages (push) Waiting to run
Update node modules cache / update_node_modules_cache (push) Waiting to run
Keep Github Actions Cache < 10GB / cache-cleaner (push) Has been cancelled
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47605 changelog: [internal] use a pointer to RuntimeScheduler instead of getting a reference to it from context container each time. Reviewed By: javache, cipolleschi Differential Revision: D65909100 fbshipit-source-id: c53c9b573777803f7f3077656af1dae0db7eee88
This commit is contained in:
parent
6db883a56c
commit
84265fd3d9
@ -54,18 +54,18 @@ Scheduler::Scheduler(
|
||||
weakRuntimeScheduler.has_value() &&
|
||||
"Unexpected state: RuntimeScheduler was not provided.");
|
||||
|
||||
auto runtimeScheduler = weakRuntimeScheduler.value().lock();
|
||||
runtimeScheduler_ = weakRuntimeScheduler.value().lock().get();
|
||||
|
||||
if (ReactNativeFeatureFlags::enableUIConsistency()) {
|
||||
runtimeScheduler->setShadowTreeRevisionConsistencyManager(
|
||||
runtimeScheduler_->setShadowTreeRevisionConsistencyManager(
|
||||
uiManager->getShadowTreeRevisionConsistencyManager());
|
||||
}
|
||||
|
||||
if (ReactNativeFeatureFlags::enableReportEventPaintTime()) {
|
||||
runtimeScheduler->setEventTimingDelegate(eventPerformanceLogger_.get());
|
||||
runtimeScheduler_->setEventTimingDelegate(eventPerformanceLogger_.get());
|
||||
}
|
||||
|
||||
auto eventPipe = [uiManager, runtimeScheduler = runtimeScheduler.get()](
|
||||
auto eventPipe = [uiManager](
|
||||
jsi::Runtime& runtime,
|
||||
const EventTarget* eventTarget,
|
||||
const std::string& type,
|
||||
@ -79,12 +79,10 @@ Scheduler::Scheduler(
|
||||
runtime);
|
||||
};
|
||||
|
||||
auto eventPipeConclusion =
|
||||
[runtimeScheduler = runtimeScheduler.get()](jsi::Runtime& runtime) {
|
||||
if (runtimeScheduler != nullptr) {
|
||||
runtimeScheduler->callExpiredTasks(runtime);
|
||||
}
|
||||
};
|
||||
auto eventPipeConclusion = [runtimeScheduler =
|
||||
runtimeScheduler_](jsi::Runtime& runtime) {
|
||||
runtimeScheduler->callExpiredTasks(runtime);
|
||||
};
|
||||
|
||||
auto statePipe = [uiManager](const StateUpdate& stateUpdate) {
|
||||
uiManager->updateState(stateUpdate);
|
||||
@ -289,16 +287,10 @@ void Scheduler::uiManagerDidFinishTransaction(
|
||||
// observe each transaction to be able to mount correctly.
|
||||
delegate_->schedulerDidFinishTransaction(mountingCoordinator);
|
||||
|
||||
auto weakRuntimeScheduler =
|
||||
contextContainer_->find<std::weak_ptr<RuntimeScheduler>>(
|
||||
"RuntimeScheduler");
|
||||
auto runtimeScheduler = weakRuntimeScheduler.has_value()
|
||||
? weakRuntimeScheduler.value().lock()
|
||||
: nullptr;
|
||||
if (runtimeScheduler && !mountSynchronously) {
|
||||
if (!mountSynchronously) {
|
||||
auto surfaceId = mountingCoordinator->getSurfaceId();
|
||||
|
||||
runtimeScheduler->scheduleRenderingUpdate(
|
||||
runtimeScheduler_->scheduleRenderingUpdate(
|
||||
surfaceId,
|
||||
[delegate = delegate_,
|
||||
mountingCoordinator = std::move(mountingCoordinator)]() {
|
||||
|
@ -139,6 +139,8 @@ class Scheduler final : public UIManagerDelegate {
|
||||
* Must not be nullptr.
|
||||
*/
|
||||
ContextContainer::Shared contextContainer_;
|
||||
|
||||
RuntimeScheduler* runtimeScheduler_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
Loading…
Reference in New Issue
Block a user