From f64e5c43530378815dc0c41fa1429bd52d358f90 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 11 Sep 2022 18:46:48 +0200 Subject: [PATCH] Add logging for CLAP callback requests --- src/common/logging/clap.cpp | 12 ++++++++++++ src/common/logging/clap.h | 11 +++++++++++ src/wine-host/bridges/clap-impls/host-proxy.cpp | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/common/logging/clap.cpp b/src/common/logging/clap.cpp index ba631e42..b0deb501 100644 --- a/src/common/logging/clap.cpp +++ b/src/common/logging/clap.cpp @@ -22,6 +22,18 @@ ClapLogger::ClapLogger(Logger& generic_logger) : logger_(generic_logger) {} +void ClapLogger::log_callback_request(size_t instance_id) { + log_request_base(false, Logger::Verbosity::all_events, [&](auto& message) { + message << "clap_host::request_callback()"; + }); +} + +void ClapLogger::log_on_main_thread(size_t instance_id) { + log_request_base(true, Logger::Verbosity::all_events, [&](auto& message) { + message << "clap_plugin::on_main_thread()"; + }); +} + bool ClapLogger::log_request(bool is_host_plugin, const clap::plugin_factory::List&) { return log_request_base(is_host_plugin, [&](auto& message) { diff --git a/src/common/logging/clap.h b/src/common/logging/clap.h index 28c2af02..edf018a2 100644 --- a/src/common/logging/clap.h +++ b/src/common/logging/clap.h @@ -37,6 +37,17 @@ class ClapLogger { // TODO: Logging for extension queries, factory type queries + /** + * Logging for `clap_host::request_callback()`. This is handled purely on + * the Wine plugin host side. + */ + void log_callback_request(size_t instance_id); + /** + * Logging for `clap_plugin::on_main_thread()`. This is handled purely on + * the Wine plugin host side. + */ + void log_on_main_thread(size_t instance_id); + // For every object we send using `ClapMessageHandler` we have overloads // that print information about the request and the response. The boolean // flag here indicates whether the request was initiated on the host side diff --git a/src/wine-host/bridges/clap-impls/host-proxy.cpp b/src/wine-host/bridges/clap-impls/host-proxy.cpp index 979bfc06..0775060e 100644 --- a/src/wine-host/bridges/clap-impls/host-proxy.cpp +++ b/src/wine-host/bridges/clap-impls/host-proxy.cpp @@ -68,7 +68,7 @@ clap_host_proxy::host_request_callback(const struct clap_host* host) { assert(host && host->host_data); auto self = static_cast(host->host_data); - // TODO: Log + self->bridge_.logger_.log_callback_request(self->owner_instance_id()); // Only schedule a `clap_plugin::on_main_thread()` call if we don't already // have a pending one. This limits the number of unnecessarily stacked @@ -86,6 +86,9 @@ clap_host_proxy::host_request_callback(const struct clap_host* host) { const auto& [instance, _] = instance_lock; self->has_pending_host_callbacks_.store(false); + self->bridge_.logger_.log_on_main_thread( + self->owner_instance_id()); + instance.plugin->on_main_thread(instance.plugin.get()); }); }