#pragma once #include #include #include #include #include #include #include #include namespace reanimated { using namespace css; class UpdatesRegistryManager { public: explicit UpdatesRegistryManager( const std::shared_ptr &staticPropsRegistry); std::lock_guard lock() const; // TODO - ensure that other sublibraries can easily hook into this registry // manager (e.g. add priority to registries) void addRegistry(const std::shared_ptr ®istry); void pauseReanimatedCommits(); bool shouldReanimatedSkipCommit(); void unpauseReanimatedCommits(); void pleaseCommitAfterPause(); bool shouldCommitAfterPause(); void cancelCommitAfterPause(); void markNodeAsRemovable(const std::shared_ptr &shadowNode); void unmarkNodeAsRemovable(Tag viewTag); void handleNodeRemovals(const RootShadowNode &rootShadowNode); PropsMap collectProps(); #ifdef ANDROID bool hasPropsToRevert(); void collectPropsToRevertBySurface( std::unordered_map &propsMapBySurface); void clearPropsToRevert(SurfaceId surfaceId); #endif private: using RemovableShadowNodes = std::unordered_map>; mutable std::mutex mutex_; std::atomic isPaused_; std::atomic shouldCommitAfterPause_; RemovableShadowNodes removableShadowNodes_; std::vector> registries_; const std::shared_ptr staticPropsRegistry_; #ifdef ANDROID PropsToRevertMap propsToRevertMap_; static void addToPropsMap( PropsMap &propsMap, const std::shared_ptr &shadowNode, const folly::dynamic &props); #endif }; } // namespace reanimated