diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-18 19:16:51 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-18 19:18:19 +0300 |
commit | 52b8d668f4d3d0a841313b678027a2d6af2fbc37 (patch) | |
tree | fbebc123c8929c2d36ba72b0e1638daed4c93c99 /source/blender/depsgraph/intern/builder/deg_builder_cache.cc | |
parent | 44f785266012cfc399f29d28f13717a317e7a348 (diff) |
Depsgraph: use blender::Map instead of std::map
We decided to use our own map data structure in general for better
readability and performance.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D7987
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_cache.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_cache.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc index 104676f7ab6..62d9118cbc0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc @@ -155,21 +155,16 @@ DepsgraphBuilderCache::DepsgraphBuilderCache() DepsgraphBuilderCache::~DepsgraphBuilderCache() { - for (AnimatedPropertyStorageMap::value_type &iter : animated_property_storage_map_) { - AnimatedPropertyStorage *animated_property_storage = iter.second; + for (AnimatedPropertyStorage *animated_property_storage : + animated_property_storage_map_.values()) { OBJECT_GUARDED_DELETE(animated_property_storage, AnimatedPropertyStorage); } } AnimatedPropertyStorage *DepsgraphBuilderCache::ensureAnimatedPropertyStorage(ID *id) { - AnimatedPropertyStorageMap::iterator it = animated_property_storage_map_.find(id); - if (it != animated_property_storage_map_.end()) { - return it->second; - } - AnimatedPropertyStorage *animated_property_storage = OBJECT_GUARDED_NEW(AnimatedPropertyStorage); - animated_property_storage_map_.insert(make_pair(id, animated_property_storage)); - return animated_property_storage; + return animated_property_storage_map_.lookup_or_add_cb( + id, []() { return OBJECT_GUARDED_NEW(AnimatedPropertyStorage); }); } AnimatedPropertyStorage *DepsgraphBuilderCache::ensureInitializedAnimatedPropertyStorage(ID *id) |