From a9815286c2c44c7ff7f2862e61231465c144b0fc Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 30 Nov 2021 04:26:16 -0800 Subject: [PATCH] Remove redundant parameter from ShadowTreeRegistry::enumerate Summary: Changelog: [internal] Nothing was using `stop` parameter, let's get rid of it. Reviewed By: philIip Differential Revision: D32669018 fbshipit-source-id: dc2d52048a2f7dd3785dd959270087001c778962 --- .../react/renderer/mounting/ShadowTreeRegistry.cpp | 9 ++------- ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h | 5 ++--- ReactCommon/react/renderer/scheduler/Scheduler.cpp | 2 +- ReactCommon/react/renderer/uimanager/UIManager.cpp | 7 +++---- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp index 8c801d8227..d2f65fb115 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp @@ -53,15 +53,10 @@ bool ShadowTreeRegistry::visit( } void ShadowTreeRegistry::enumerate( - std::function callback) - const { + std::function callback) const { std::shared_lock lock(mutex_); - bool stop = false; for (auto const &pair : registry_) { - callback(*pair.second, stop); - if (stop) { - break; - } + callback(*pair.second); } } diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h index e2cee3d8c6..9958611203 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h @@ -54,11 +54,10 @@ class ShadowTreeRegistry final { /* * Enumerates all stored shadow trees. - * Set `stop` to `true` to interrupt the enumeration. * Can be called from any thread. */ - void enumerate(std::function - callback) const; + void enumerate( + std::function callback) const; private: mutable better::shared_mutex mutex_; diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/ReactCommon/react/renderer/scheduler/Scheduler.cpp index 15cff205ff..5da3c21d4c 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -143,7 +143,7 @@ Scheduler::~Scheduler() { // Then, let's verify that the requirement was satisfied. auto surfaceIds = std::vector{}; uiManager_->getShadowTreeRegistry().enumerate( - [&](ShadowTree const &shadowTree, bool &stop) { + [&surfaceIds](ShadowTree const &shadowTree) { surfaceIds.push_back(shadowTree.getSurfaceId()); }); diff --git a/ReactCommon/react/renderer/uimanager/UIManager.cpp b/ReactCommon/react/renderer/uimanager/UIManager.cpp index 56bb2bad80..c52286aa3b 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -449,10 +449,9 @@ void UIManager::stopSurfaceForAnimationDelegate(SurfaceId surfaceId) const { void UIManager::animationTick() { if (animationDelegate_ != nullptr && animationDelegate_->shouldAnimateFrame()) { - shadowTreeRegistry_.enumerate( - [&](ShadowTree const &shadowTree, bool &stop) { - shadowTree.notifyDelegatesOfUpdates(); - }); + shadowTreeRegistry_.enumerate([](ShadowTree const &shadowTree) { + shadowTree.notifyDelegatesOfUpdates(); + }); } }