Noexcept qualify the VST3 proxy implementations

For the same reasons mentioned in the last commit.
This commit is contained in:
Robbert van der Helm
2021-05-14 17:30:05 +02:00
parent 59ba2aeb5f
commit 8ba6e4a937
18 changed files with 37 additions and 27 deletions
@@ -17,7 +17,7 @@
#include "context-menu-target.h" #include "context-menu-target.h"
YaContextMenuTargetImpl::YaContextMenuTargetImpl(Vst3PluginBridge& bridge, YaContextMenuTargetImpl::YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
const ConstructArgs&& args) const ConstructArgs&& args) noexcept
: YaContextMenuTarget(std::move(args)), bridge(bridge) {} : YaContextMenuTarget(std::move(args)), bridge(bridge) {}
tresult PLUGIN_API tresult PLUGIN_API
@@ -21,7 +21,7 @@
class YaContextMenuTargetImpl : public YaContextMenuTarget { class YaContextMenuTargetImpl : public YaContextMenuTarget {
public: public:
YaContextMenuTargetImpl(Vst3PluginBridge& bridge, YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
const ConstructArgs&& args); const ConstructArgs&& args) noexcept;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -86,16 +86,19 @@ RunLoopTasks::onFDIsSet(Steinberg::Linux::FileDescriptor /*fd*/) {
Vst3PlugViewProxyImpl::Vst3PlugViewProxyImpl( Vst3PlugViewProxyImpl::Vst3PlugViewProxyImpl(
Vst3PluginBridge& bridge, Vst3PluginBridge& bridge,
std::atomic_bool& is_active, std::atomic_bool& is_active,
Vst3PlugViewProxy::ConstructArgs&& args) Vst3PlugViewProxy::ConstructArgs&& args) noexcept
: Vst3PlugViewProxy(std::move(args)), bridge(bridge), is_active(is_active) { : Vst3PlugViewProxy(std::move(args)), bridge(bridge), is_active(is_active) {
is_active = true; is_active = true;
} }
Vst3PlugViewProxyImpl::~Vst3PlugViewProxyImpl() { Vst3PlugViewProxyImpl::~Vst3PlugViewProxyImpl() noexcept {
is_active = false; is_active = false;
// Also drop the plug view smart pointer on the Wine side when this gets // Also drop the plug view smart pointer on the Wine side when this gets
// dropped // dropped
// NOTE: This can actually throw (e.g. out of memory or the socket got
// closed). But if that were to happen, then we wouldn't be able to
// recover from it anyways.
send_mutually_recursive_message( send_mutually_recursive_message(
Vst3PlugViewProxy::Destruct{.owner_instance_id = owner_instance_id()}); Vst3PlugViewProxy::Destruct{.owner_instance_id = owner_instance_id()});
} }
@@ -107,14 +107,14 @@ class Vst3PlugViewProxyImpl : public Vst3PlugViewProxy {
public: public:
Vst3PlugViewProxyImpl(Vst3PluginBridge& bridge, Vst3PlugViewProxyImpl(Vst3PluginBridge& bridge,
std::atomic_bool& is_active, std::atomic_bool& is_active,
Vst3PlugViewProxy::ConstructArgs&& args); Vst3PlugViewProxy::ConstructArgs&& args) noexcept;
/** /**
* When the reference count reaches zero and this destructor is called, * When the reference count reaches zero and this destructor is called,
* we'll send a request to the Wine plugin host to destroy the corresponding * we'll send a request to the Wine plugin host to destroy the corresponding
* object. * object.
*/ */
~Vst3PlugViewProxyImpl(); ~Vst3PlugViewProxyImpl() noexcept override;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -23,7 +23,7 @@
Vst3PluginFactoryProxyImpl::Vst3PluginFactoryProxyImpl( Vst3PluginFactoryProxyImpl::Vst3PluginFactoryProxyImpl(
Vst3PluginBridge& bridge, Vst3PluginBridge& bridge,
Vst3PluginFactoryProxy::ConstructArgs&& args) Vst3PluginFactoryProxy::ConstructArgs&& args) noexcept
: Vst3PluginFactoryProxy(std::move(args)), bridge(bridge) {} : Vst3PluginFactoryProxy(std::move(args)), bridge(bridge) {}
tresult PLUGIN_API tresult PLUGIN_API
@@ -25,7 +25,7 @@ class Vst3PluginBridge;
class Vst3PluginFactoryProxyImpl : public Vst3PluginFactoryProxy { class Vst3PluginFactoryProxyImpl : public Vst3PluginFactoryProxy {
public: public:
Vst3PluginFactoryProxyImpl(Vst3PluginBridge& bridge, Vst3PluginFactoryProxyImpl(Vst3PluginBridge& bridge,
Vst3PluginFactoryProxy::ConstructArgs&& args); Vst3PluginFactoryProxy::ConstructArgs&& args) noexcept;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -45,7 +45,10 @@ Vst3PluginProxyImpl::Vst3PluginProxyImpl(Vst3PluginBridge& bridge,
bridge.register_plugin_proxy(*this); bridge.register_plugin_proxy(*this);
} }
Vst3PluginProxyImpl::~Vst3PluginProxyImpl() { Vst3PluginProxyImpl::~Vst3PluginProxyImpl() noexcept {
// NOTE: This can actually throw (e.g. out of memory or the socket got
// closed). But if that were to happen, then we wouldn't be able to
// recover from it anyways.
bridge.send_message( bridge.send_message(
Vst3PluginProxy::Destruct{.instance_id = instance_id()}); Vst3PluginProxy::Destruct{.instance_id = instance_id()});
bridge.unregister_plugin_proxy(*this); bridge.unregister_plugin_proxy(*this);
@@ -80,7 +83,7 @@ bool Vst3PluginProxyImpl::unregister_context_menu(size_t context_menu_id) {
return context_menus.erase(context_menu_id); return context_menus.erase(context_menu_id);
} }
void Vst3PluginProxyImpl::clear_caches() { void Vst3PluginProxyImpl::clear_caches() noexcept {
clear_bus_cache(); clear_bus_cache();
std::lock_guard lock(function_result_cache_mutex); std::lock_guard lock(function_result_cache_mutex);
@@ -1325,7 +1328,7 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getXmlRepresentationStream(
} }
} }
void Vst3PluginProxyImpl::clear_bus_cache() { void Vst3PluginProxyImpl::clear_bus_cache() noexcept {
std::lock_guard lock(processing_bus_cache_mutex); std::lock_guard lock(processing_bus_cache_mutex);
if (processing_bus_cache) { if (processing_bus_cache) {
processing_bus_cache.emplace(); processing_bus_cache.emplace();
+3 -3
View File
@@ -36,7 +36,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* we'll send a request to the Wine plugin host to destroy the corresponding * we'll send a request to the Wine plugin host to destroy the corresponding
* object. * object.
*/ */
~Vst3PluginProxyImpl(); ~Vst3PluginProxyImpl() noexcept override;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -72,7 +72,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* @see clear_bus_cache * @see clear_bus_cache
* @see function_result_cache * @see function_result_cache
*/ */
void clear_caches(); void clear_caches() noexcept;
// From `IAudioPresentationLatency` // From `IAudioPresentationLatency`
tresult PLUGIN_API tresult PLUGIN_API
@@ -415,7 +415,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* *
* @see processing_bus_cache * @see processing_bus_cache
*/ */
void clear_bus_cache(); void clear_bus_cache() noexcept;
/** /**
* If we have an active `IPlugView` instance, try to use the mutual * If we have an active `IPlugView` instance, try to use the mutual
@@ -22,7 +22,7 @@
Vst3ComponentHandlerProxyImpl::Vst3ComponentHandlerProxyImpl( Vst3ComponentHandlerProxyImpl::Vst3ComponentHandlerProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3ComponentHandlerProxy::ConstructArgs&& args) Vst3ComponentHandlerProxy::ConstructArgs&& args) noexcept
: Vst3ComponentHandlerProxy(std::move(args)), bridge(bridge) { : Vst3ComponentHandlerProxy(std::move(args)), bridge(bridge) {
// The lifecycle of this object is managed together with that of the plugin // The lifecycle of this object is managed together with that of the plugin
// object instance this host context got passed to // object instance this host context got passed to
@@ -22,7 +22,7 @@ class Vst3ComponentHandlerProxyImpl : public Vst3ComponentHandlerProxy {
public: public:
Vst3ComponentHandlerProxyImpl( Vst3ComponentHandlerProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3ComponentHandlerProxy::ConstructArgs&& args); Vst3ComponentHandlerProxy::ConstructArgs&& args) noexcept;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -20,7 +20,7 @@
Vst3ConnectionPointProxyImpl::Vst3ConnectionPointProxyImpl( Vst3ConnectionPointProxyImpl::Vst3ConnectionPointProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3ConnectionPointProxy::ConstructArgs&& args) Vst3ConnectionPointProxy::ConstructArgs&& args) noexcept
: Vst3ConnectionPointProxy(std::move(args)), bridge(bridge) {} : Vst3ConnectionPointProxy(std::move(args)), bridge(bridge) {}
tresult PLUGIN_API tresult PLUGIN_API
@@ -22,7 +22,7 @@ class Vst3ConnectionPointProxyImpl : public Vst3ConnectionPointProxy {
public: public:
Vst3ConnectionPointProxyImpl( Vst3ConnectionPointProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3ConnectionPointProxy::ConstructArgs&& args); Vst3ConnectionPointProxy::ConstructArgs&& args) noexcept;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -20,14 +20,17 @@
Vst3ContextMenuProxyImpl::Vst3ContextMenuProxyImpl( Vst3ContextMenuProxyImpl::Vst3ContextMenuProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3ContextMenuProxy::ConstructArgs&& args) Vst3ContextMenuProxy::ConstructArgs&& args) noexcept
: Vst3ContextMenuProxy(std::move(args)), bridge(bridge) { : Vst3ContextMenuProxy(std::move(args)), bridge(bridge) {
bridge.register_context_menu(*this); bridge.register_context_menu(*this);
} }
Vst3ContextMenuProxyImpl::~Vst3ContextMenuProxyImpl() { Vst3ContextMenuProxyImpl::~Vst3ContextMenuProxyImpl() noexcept {
// Also drop the context menu smart pointer on plugin side when this gets // Also drop the context menu smart pointer on plugin side when this gets
// dropped // dropped
// NOTE: This can actually throw (e.g. out of memory or the socket got
// closed). But if that were to happen, then we wouldn't be able to
// recover from it anyways.
bridge.send_message( bridge.send_message(
Vst3ContextMenuProxy::Destruct{.owner_instance_id = owner_instance_id(), Vst3ContextMenuProxy::Destruct{.owner_instance_id = owner_instance_id(),
.context_menu_id = context_menu_id()}); .context_menu_id = context_menu_id()});
@@ -20,14 +20,15 @@
class Vst3ContextMenuProxyImpl : public Vst3ContextMenuProxy { class Vst3ContextMenuProxyImpl : public Vst3ContextMenuProxy {
public: public:
Vst3ContextMenuProxyImpl(Vst3Bridge& bridge, Vst3ContextMenuProxyImpl(
Vst3ContextMenuProxy::ConstructArgs&& args); Vst3Bridge& bridge,
Vst3ContextMenuProxy::ConstructArgs&& args) noexcept;
/** /**
* When the reference count reaches zero and this destructor is called, * When the reference count reaches zero and this destructor is called,
* we'll send a request to plugin to destroy the corresponding object. * we'll send a request to plugin to destroy the corresponding object.
*/ */
~Vst3ContextMenuProxyImpl(); ~Vst3ContextMenuProxyImpl() noexcept override;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -23,7 +23,7 @@
Vst3HostContextProxyImpl::Vst3HostContextProxyImpl( Vst3HostContextProxyImpl::Vst3HostContextProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3HostContextProxy::ConstructArgs&& args) Vst3HostContextProxy::ConstructArgs&& args) noexcept
: Vst3HostContextProxy(std::move(args)), bridge(bridge) { : Vst3HostContextProxy(std::move(args)), bridge(bridge) {
// The lifecycle of this object is managed together with that of the plugin // The lifecycle of this object is managed together with that of the plugin
// object instance this host context got passed to // object instance this host context got passed to
@@ -21,7 +21,7 @@
class Vst3HostContextProxyImpl : public Vst3HostContextProxy { class Vst3HostContextProxyImpl : public Vst3HostContextProxy {
public: public:
Vst3HostContextProxyImpl(Vst3Bridge& bridge, Vst3HostContextProxyImpl(Vst3Bridge& bridge,
Vst3HostContextProxy::ConstructArgs&& args); Vst3HostContextProxy::ConstructArgs&& args) noexcept;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do
@@ -20,7 +20,7 @@
Vst3PlugFrameProxyImpl::Vst3PlugFrameProxyImpl( Vst3PlugFrameProxyImpl::Vst3PlugFrameProxyImpl(
Vst3Bridge& bridge, Vst3Bridge& bridge,
Vst3PlugFrameProxy::ConstructArgs&& args) Vst3PlugFrameProxy::ConstructArgs&& args) noexcept
: Vst3PlugFrameProxy(std::move(args)), bridge(bridge) { : Vst3PlugFrameProxy(std::move(args)), bridge(bridge) {
// The lifecycle of this object is managed together with that of the plugin // The lifecycle of this object is managed together with that of the plugin
// object instance this host context got passed to // object instance this host context got passed to
@@ -21,7 +21,7 @@
class Vst3PlugFrameProxyImpl : public Vst3PlugFrameProxy { class Vst3PlugFrameProxyImpl : public Vst3PlugFrameProxy {
public: public:
Vst3PlugFrameProxyImpl(Vst3Bridge& bridge, Vst3PlugFrameProxyImpl(Vst3Bridge& bridge,
Vst3PlugFrameProxy::ConstructArgs&& args); Vst3PlugFrameProxy::ConstructArgs&& args) noexcept;
/** /**
* We'll override the query interface to log queries for interfaces we do * We'll override the query interface to log queries for interfaces we do