Audacity 3.2.0
|
Internal class, processes plugin validation requests from the main app. Request is a simple string formatted by detail::MakeRequestString. After connection is established host starts to wait for a request from server. Once request is successfully processed host sends a reply. Host is capable to handle only one request at a time, so it's not allowed to send another request until host hasn't finish processing previous request. More...
#include <PluginHost.h>
Public Member Functions | |
PluginHost (int connectPort) | |
void | OnConnect (IPCChannel &channel) noexcept override |
Called when connection established. More... | |
void | OnDisconnect () noexcept override |
Invalidates IPCChannel passed as argument in OnConnect. More... | |
void | OnConnectionError () noexcept override |
Called when connection attempt fails. More... | |
void | OnDataAvailable (const void *data, size_t size) noexcept override |
Called when data chunk received as a result of a preceding call to IPCChannel::Send. Generally, data pointer should not be accessed outside this method, copied if necessary. More... | |
bool | Serve () |
Public Member Functions inherited from IPCChannelStatusCallback | |
virtual | ~IPCChannelStatusCallback () |
virtual void | OnConnectionError () noexcept=0 |
Called when connection attempt fails. More... | |
virtual void | OnConnect (IPCChannel &channel) noexcept=0 |
Called when connection established. More... | |
virtual void | OnDisconnect () noexcept=0 |
Invalidates IPCChannel passed as argument in OnConnect. More... | |
virtual void | OnDataAvailable (const void *data, size_t size) noexcept=0 |
Called when data chunk received as a result of a preceding call to IPCChannel::Send. Generally, data pointer should not be accessed outside this method, copied if necessary. More... | |
Static Public Member Functions | |
static bool | Start (int connectPort) |
Attempts to start a host application (should be called from the main application) More... | |
static bool | IsHostProcess () |
Returns true if current process is considered to be a plugin host process. More... | |
Private Member Functions | |
void | Stop () noexcept |
Private Attributes | |
std::unique_ptr< IPCClient > | mClient |
IPCChannel * | mChannel {nullptr} |
detail::InputMessageReader | mInputMessageReader |
std::mutex | mSync |
std::condition_variable | mRequestCondition |
std::optional< wxString > | mRequest |
bool | mRunning {true} |
Static Private Attributes | |
static constexpr auto | HostArgument = "--host" |
Internal class, processes plugin validation requests from the main app. Request is a simple string formatted by detail::MakeRequestString. After connection is established host starts to wait for a request from server. Once request is successfully processed host sends a reply. Host is capable to handle only one request at a time, so it's not allowed to send another request until host hasn't finish processing previous request.
Definition at line 35 of file PluginHost.h.
|
explicit |
Definition at line 77 of file PluginHost.cpp.
References GlobalHook< ApplicationSettings, std::unique_ptr< BasicSettings >()>::Call(), ModuleManager::Get(), FileNames::InitializePathList(), InitPreferences(), and mClient.
|
static |
Returns true if current process is considered to be a plugin host process.
Definition at line 202 of file PluginHost.cpp.
References CommandLineArgs::argc, CommandLineArgs::argv, and HostArgument.
Referenced by LV2EffectsModule::Initialize(), AudacityApp::Initialize(), main(), ModuleDispatch(), and PluginHostModule::OnInit().
|
overridevirtualnoexcept |
Called when connection established.
channel | Using this channel client or server can send data to the other side. |
Implements IPCChannelStatusCallback.
Definition at line 89 of file PluginHost.cpp.
|
overridevirtualnoexcept |
Called when connection attempt fails.
Implements IPCChannelStatusCallback.
Definition at line 100 of file PluginHost.cpp.
References Stop().
|
overridevirtualnoexcept |
Called when data chunk received as a result of a preceding call to IPCChannel::Send. Generally, data pointer should not be accessed outside this method, copied if necessary.
data | Pointer to the chunk |
size | Size of the chunk |
Implements IPCChannelStatusCallback.
Definition at line 105 of file PluginHost.cpp.
References size.
|
overridevirtualnoexcept |
Invalidates IPCChannel passed as argument in OnConnect.
Implements IPCChannelStatusCallback.
Definition at line 95 of file PluginHost.cpp.
References Stop().
bool PluginHost::Serve | ( | ) |
Definition at line 126 of file PluginHost.cpp.
References anonymous_namespace{PluginHost.cpp}::Discover(), mChannel, mRequest, mRequestCondition, mRunning, mSync, detail::ParseRequestString(), detail::PutMessage(), detail::PluginValidationResult::SetError(), and detail::PluginValidationResult::WriteXML().
Referenced by PluginHostModule::OnInit().
|
static |
Attempts to start a host application (should be called from the main application)
Definition at line 184 of file PluginHost.cpp.
References PlatformCompatibility::GetExecutablePath(), and HostArgument.
Referenced by AsyncPluginValidator::Impl::StartHost().
|
privatenoexcept |
Definition at line 164 of file PluginHost.cpp.
References mChannel, mRequestCondition, mRunning, and mSync.
Referenced by OnConnectionError(), and OnDisconnect().
|
staticconstexprprivate |
Definition at line 37 of file PluginHost.h.
Referenced by IsHostProcess(), and Start().
|
private |
Definition at line 40 of file PluginHost.h.
|
private |
Definition at line 39 of file PluginHost.h.
Referenced by PluginHost().
|
private |
Definition at line 41 of file PluginHost.h.
|
private |
Definition at line 44 of file PluginHost.h.
Referenced by Serve().
|
private |
Definition at line 43 of file PluginHost.h.
|
private |
Definition at line 46 of file PluginHost.h.
|
private |
Definition at line 42 of file PluginHost.h.