diff --git a/Source/WPEFramework/PluginServer.h b/Source/WPEFramework/PluginServer.h index c7c86b393..5538ff0c7 100644 --- a/Source/WPEFramework/PluginServer.h +++ b/Source/WPEFramework/PluginServer.h @@ -1242,11 +1242,11 @@ namespace PluginHost { { _administrator.Unregister(sink); } - void Register(IShell::ICOMLink::INotification* sink) + void Register(IShell::ICOMLink::INotification* sink) override { _administrator.Register(sink); } - void Unregister(IShell::ICOMLink::INotification* sink) + void Unregister(const IShell::ICOMLink::INotification* sink) override { _administrator.Unregister(sink); } @@ -2116,7 +2116,7 @@ namespace PluginHost { _adminLock.Unlock(); } } - void Unregister(IShell::ICOMLink::INotification* sink) + void Unregister(const IShell::ICOMLink::INotification* sink) { ASSERT(sink != nullptr); @@ -2817,7 +2817,7 @@ namespace PluginHost { { _processAdministrator.Register(sink); } - void Unregister(IShell::ICOMLink::INotification* sink) + void Unregister(const IShell::ICOMLink::INotification* sink) { _processAdministrator.Unregister(sink); } diff --git a/Source/plugins/IShell.h b/Source/plugins/IShell.h index 722b30faa..5d64632b6 100644 --- a/Source/plugins/IShell.h +++ b/Source/plugins/IShell.h @@ -55,7 +55,7 @@ namespace PluginHost { virtual void Unregister(const RPC::IRemoteConnection::INotification* sink) = 0; virtual void Register(INotification* sink) = 0; - virtual void Unregister(INotification* sink) = 0; + virtual void Unregister(const INotification* sink) = 0; virtual RPC::IRemoteConnection* RemoteConnection(const uint32_t connectionId) = 0; virtual void* Instantiate(const RPC::Object& object, const uint32_t waitTime, uint32_t& connectionId) = 0; @@ -239,7 +239,7 @@ namespace PluginHost { virtual Core::hresult Resumed(const bool value) = 0; virtual string HashKey() const = 0; - + virtual string ConfigLine() const = 0; virtual Core::hresult ConfigLine(const string& config) = 0; virtual Core::hresult Metadata(string& info /* @out */) const = 0; @@ -273,9 +273,6 @@ namespace PluginHost { virtual Core::hresult Hibernate(const uint32_t timeout) = 0; virtual reason Reason() const = 0; - virtual void Register(IConnectionServer::INotification* sink) = 0; - virtual void Unregister(const IConnectionServer::INotification* sink) = 0; - // Method to access, in the main process space, the channel factory to submit JSON objects to be send. // This method will return a error if it is NOT in the main process. /* @stubgen:stub */ @@ -335,6 +332,32 @@ namespace PluginHost { handler->Release(); } } + inline void Register(IConnectionServer::INotification* sink) + { + ASSERT(sink != nullptr); + + IConnectionServer* handler(QueryInterface()); + + ASSERT(handler != nullptr); + + if (handler != nullptr) { + handler->Register(sink); + handler->Release(); + } + } + inline void Unregister(const IConnectionServer::INotification* sink) + { + ASSERT(sink != nullptr); + + IConnectionServer* handler(QueryInterface()); + + ASSERT(handler != nullptr); + + if (handler != nullptr) { + handler->Unregister(sink); + handler->Release(); + } + } inline RPC::IRemoteConnection* RemoteConnection(const uint32_t connectionId) { RPC::IRemoteConnection* connection(nullptr);