diff options
author | David Robillard <d@drobilla.net> | 2017-02-12 15:04:20 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-02-12 15:31:47 +0100 |
commit | b1198f0842e6e4d6b1c01f07d91b42ef4a212788 (patch) | |
tree | 93fdf4da89a6f5f634707fb8c989e0d9ee1a3c65 /src/server/PreProcessContext.hpp | |
parent | 81d45973412c675e3c0b4a10b64d811a219feeae (diff) | |
download | ingen-b1198f0842e6e4d6b1c01f07d91b42ef4a212788.tar.gz ingen-b1198f0842e6e4d6b1c01f07d91b42ef4a212788.tar.bz2 ingen-b1198f0842e6e4d6b1c01f07d91b42ef4a212788.zip |
Use smart pointers to handle real-time memory disposal
Diffstat (limited to 'src/server/PreProcessContext.hpp')
-rw-r--r-- | src/server/PreProcessContext.hpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/server/PreProcessContext.hpp b/src/server/PreProcessContext.hpp index bf1115e8..ee9bed86 100644 --- a/src/server/PreProcessContext.hpp +++ b/src/server/PreProcessContext.hpp @@ -21,6 +21,8 @@ #include "GraphImpl.hpp" +namespace Raul { class Maid; } + namespace Ingen { namespace Server { @@ -44,17 +46,29 @@ public: * This may return false when an atomic bundle is deferring compilation, in * which case the graph is flagged as dirty for later compilation. */ - bool must_compile(GraphImpl* graph) { - if (!graph->enabled()) { + bool must_compile(GraphImpl& graph) { + if (!graph.enabled()) { return false; } else if (_in_bundle) { - _dirty_graphs.insert(graph); + _dirty_graphs.insert(&graph); return false; } else { return true; } } + /** Compile graph and return the result if necessary. + * + * This may return null when an atomic bundle is deferring compilation, in + * which case the graph is flagged as dirty for later compilation. + */ + MPtr<CompiledGraph> maybe_compile(Raul::Maid& maid, GraphImpl& graph) { + if (must_compile(graph)) { + return CompiledGraph::compile(maid, graph); + } + return MPtr<CompiledGraph>(); + } + /** Return all graphs that require compilation after an atomic bundle. */ const DirtyGraphs& dirty_graphs() const { return _dirty_graphs; } DirtyGraphs& dirty_graphs() { return _dirty_graphs; } |