[Bf-blender-cvs] [727a8da77f4] functions: make Function class a bit smaller
Jacques Lucke
noreply at git.blender.org
Thu Sep 26 18:08:07 CEST 2019
Commit: 727a8da77f47834b1a69ced02fc5de7948ff1622
Author: Jacques Lucke
Date: Thu Sep 26 17:35:59 2019 +0200
Branches: functions
https://developer.blender.org/rB727a8da77f47834b1a69ced02fc5de7948ff1622
make Function class a bit smaller
===================================================================
M source/blender/functions/core/function.hpp
===================================================================
diff --git a/source/blender/functions/core/function.hpp b/source/blender/functions/core/function.hpp
index 3d41c379339..8eceb8dde9d 100644
--- a/source/blender/functions/core/function.hpp
+++ b/source/blender/functions/core/function.hpp
@@ -169,7 +169,7 @@ class Function final : public RefCounter {
Vector<Type *> m_output_types;
std::mutex m_modify_mutex;
- OwnedResources m_resources;
+ std::unique_ptr<OwnedResources> m_resources;
const char *m_strings;
};
@@ -291,7 +291,12 @@ inline ArrayRef<Type *> Function::output_types() const
template<typename T> void Function::add_resource(std::unique_ptr<T> resource, const char *name)
{
std::lock_guard<std::mutex> lock(m_modify_mutex);
- m_resources.add(std::move(resource), name);
+
+ if (m_resources.get() == nullptr) {
+ m_resources = make_unique<OwnedResources>();
+ }
+
+ m_resources->add(std::move(resource), name);
}
/* Function Body inline functions
More information about the Bf-blender-cvs
mailing list