Pull handling of stopped surfaces into separate method
Summary: changelog: [internal] Just moves stopped surfaces logic into separate method Reviewed By: RSNara Differential Revision: D30756213 fbshipit-source-id: d8eb637e6b9fc77c400dfdefa900ebaa89710825
This commit is contained in:
Родитель
668ce510bd
Коммит
ba6f21e32d
|
@ -177,33 +177,7 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
|||
uint64_t now = now_();
|
||||
|
||||
bool inflightAnimationsExistInitially = !inflightAnimations_.empty();
|
||||
|
||||
// Execute stopSurface on any ongoing animations
|
||||
if (inflightAnimationsExistInitially) {
|
||||
better::set<SurfaceId> surfaceIdsToStop{};
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(surfaceIdsToStopMutex_);
|
||||
surfaceIdsToStop = surfaceIdsToStop_;
|
||||
surfaceIdsToStop_.clear();
|
||||
}
|
||||
|
||||
for (auto it = inflightAnimations_.begin();
|
||||
it != inflightAnimations_.end();) {
|
||||
const auto &animation = *it;
|
||||
|
||||
#ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
|
||||
LOG(ERROR)
|
||||
<< "LayoutAnimations: stopping animation due to stopSurface on "
|
||||
<< surfaceId;
|
||||
#endif
|
||||
if (surfaceIdsToStop.find(animation.surfaceId) !=
|
||||
surfaceIdsToStop.end()) {
|
||||
it = inflightAnimations_.erase(it);
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
deleteAnimationsForStoppedSurfaces();
|
||||
|
||||
if (!mutations.empty()) {
|
||||
#ifdef RN_SHADOW_TREE_INTROSPECTION
|
||||
|
@ -1693,5 +1667,37 @@ void LayoutAnimationKeyFrameManager::getAndEraseConflictingAnimations(
|
|||
}
|
||||
}
|
||||
|
||||
void LayoutAnimationKeyFrameManager::deleteAnimationsForStoppedSurfaces()
|
||||
const {
|
||||
bool inflightAnimationsExistInitially = !inflightAnimations_.empty();
|
||||
|
||||
// Execute stopSurface on any ongoing animations
|
||||
if (inflightAnimationsExistInitially) {
|
||||
better::set<SurfaceId> surfaceIdsToStop{};
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(surfaceIdsToStopMutex_);
|
||||
surfaceIdsToStop = surfaceIdsToStop_;
|
||||
surfaceIdsToStop_.clear();
|
||||
}
|
||||
|
||||
for (auto it = inflightAnimations_.begin();
|
||||
it != inflightAnimations_.end();) {
|
||||
const auto &animation = *it;
|
||||
|
||||
#ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
|
||||
LOG(ERROR)
|
||||
<< "LayoutAnimations: stopping animation due to stopSurface on "
|
||||
<< surfaceId;
|
||||
#endif
|
||||
if (surfaceIdsToStop.find(animation.surfaceId) !=
|
||||
surfaceIdsToStop.end()) {
|
||||
it = inflightAnimations_.erase(it);
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
|
|
|
@ -166,6 +166,11 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate,
|
|||
SurfaceId surfaceId,
|
||||
ShadowViewMutationList const &mutations,
|
||||
std::vector<AnimationKeyFrame> &conflictingAnimations) const;
|
||||
|
||||
/*
|
||||
* Removes animations from `inflightAnimations_` for stopped surfaces.
|
||||
*/
|
||||
void deleteAnimationsForStoppedSurfaces() const;
|
||||
};
|
||||
|
||||
static inline bool shouldFirstComeBeforeSecondRemovesOnly(
|
||||
|
|
Загрузка…
Ссылка в новой задаче