Skip to content

Commit

Permalink
Remove redundant parameter from ShadowTreeRegistry::enumerate
Browse files Browse the repository at this point in the history
Summary:
Changelog: [internal]

Nothing was using `stop` parameter, let's get rid of it.

Reviewed By: philIip

Differential Revision: D32669018

fbshipit-source-id: dc2d52048a2f7dd3785dd959270087001c778962
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Nov 30, 2021
1 parent fab4752 commit a981528
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
9 changes: 2 additions & 7 deletions ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,10 @@ bool ShadowTreeRegistry::visit(
}

void ShadowTreeRegistry::enumerate(
std::function<void(const ShadowTree &shadowTree, bool &stop)> callback)
const {
std::function<void(const ShadowTree &shadowTree)> callback) const {
std::shared_lock<better::shared_mutex> lock(mutex_);
bool stop = false;
for (auto const &pair : registry_) {
callback(*pair.second, stop);
if (stop) {
break;
}
callback(*pair.second);
}
}

Expand Down
5 changes: 2 additions & 3 deletions ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(const ShadowTree &shadowTree, bool &stop)>
callback) const;
void enumerate(
std::function<void(const ShadowTree &shadowTree)> callback) const;

private:
mutable better::shared_mutex mutex_;
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Scheduler::~Scheduler() {
// Then, let's verify that the requirement was satisfied.
auto surfaceIds = std::vector<SurfaceId>{};
uiManager_->getShadowTreeRegistry().enumerate(
[&](ShadowTree const &shadowTree, bool &stop) {
[&surfaceIds](ShadowTree const &shadowTree) {
surfaceIds.push_back(shadowTree.getSurfaceId());
});

Expand Down
7 changes: 3 additions & 4 deletions ReactCommon/react/renderer/uimanager/UIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
}

Expand Down

0 comments on commit a981528

Please sign in to comment.