diff --git a/td/telegram/AnimationsManager.cpp b/td/telegram/AnimationsManager.cpp index 8306a425a..4afd6e32e 100644 --- a/td/telegram/AnimationsManager.cpp +++ b/td/telegram/AnimationsManager.cpp @@ -229,13 +229,7 @@ FileId AnimationsManager::on_get_animation(unique_ptr new_animation, } const AnimationsManager::Animation *AnimationsManager::get_animation(FileId file_id) const { - auto animation = animations_.find(file_id); - if (animation == animations_.end()) { - return nullptr; - } - - CHECK(animation->second->file_id == file_id); - return animation->second.get(); + return animations_.get_pointer(file_id); } FileId AnimationsManager::get_animation_thumbnail_file_id(FileId file_id) const { diff --git a/td/telegram/AnimationsManager.h b/td/telegram/AnimationsManager.h index 2a5c46e0c..17d08754c 100644 --- a/td/telegram/AnimationsManager.h +++ b/td/telegram/AnimationsManager.h @@ -18,9 +18,9 @@ #include "td/utils/buffer.h" #include "td/utils/common.h" -#include "td/utils/FlatHashMap.h" #include "td/utils/Promise.h" #include "td/utils/Status.h" +#include "td/utils/WaitFreeHashMap.h" namespace td { @@ -145,7 +145,7 @@ class AnimationsManager final : public Actor { Td *td_; ActorShared<> parent_; - FlatHashMap, FileIdHash> animations_; + WaitFreeHashMap, FileIdHash> animations_; int32 saved_animations_limit_ = 200; vector saved_animation_ids_; diff --git a/td/telegram/AudiosManager.cpp b/td/telegram/AudiosManager.cpp index 49d25320a..7a3fb6de5 100644 --- a/td/telegram/AudiosManager.cpp +++ b/td/telegram/AudiosManager.cpp @@ -122,13 +122,7 @@ FileId AudiosManager::on_get_audio(unique_ptr