Split plugin classes and derive AIFilePicker from BasicPluginBase (part 4).

Add back fixes that were in Singularity (in indra/media_plugins) but not
in imprudence.

Also:

Add "shutdown" plugin message and terminate file picker plugins cleanly.

The DSO (libbasic_plugin_filepicker.so) now tells the child process /
plugin loader (SLPlugin) to terminate (using the 'shutdown' message),
and AIFilePicker::finish_impl destroys the plugin object on the viewer
side when it's ... finished thus.

Also added a large comment that gives an overview of all classes
involved on the viewer side.

Additional fixes for filepicker.

Plugin refactor bug fix: mDeleteMe was uninitialized in AIPluginFilePicker.
This commit is contained in:
Aleric Inglewood
2011-05-06 16:29:43 +02:00
parent 16cd4c5c4b
commit c46c86ca4b
21 changed files with 129 additions and 55 deletions

View File

@@ -46,10 +46,9 @@
///
/// @param[in] send_message_function Function for sending messages from plugin to plugin loader shell
/// @param[in] plugin_instance Message data for messages from plugin to plugin loader shell
BasicPluginBase::BasicPluginBase(LLPluginInstance::sendMessageFunction send_message_function, LLPluginInstance* plugin_instance)
BasicPluginBase::BasicPluginBase(LLPluginInstance::sendMessageFunction send_message_function, LLPluginInstance* plugin_instance) :
mPluginInstance(plugin_instance), mSendMessageFunction(send_message_function), mDeleteMe(false)
{
mSendMessageFunction = send_message_function;
mPluginInstance = plugin_instance;
}
/**
@@ -79,6 +78,12 @@ void BasicPluginBase::staticReceiveMessage(char const* message_string, BasicPlug
// This is the loaded DSO.
//
// Call this function to send 'message' to the viewer.
// Note: mSendMessageFunction points to LLPluginInstance::staticReceiveMessage, so indirectly this
// just calls LLPluginInstance::receiveMessage (mPluginInstance->receiveMessage) where
// mPluginInstance is the LLPluginInstance created in LLPluginProcessChild::idle during
// state STATE_PLUGIN_LOADING. That function then immediately calls mOwner->receivePluginMessage
// which is implemented as LLPluginProcessChild::receivePluginMessage, the same
// LLPluginProcessChild object that created the LLPluginInstance.
/**
* Send message to plugin loader shell.
*
@@ -91,6 +96,17 @@ void BasicPluginBase::sendMessage(const LLPluginMessage &message)
mSendMessageFunction(output.c_str(), &mPluginInstance);
}
/**
* Send shutdown message to the plugin loader shell.
*
* This will cause the SLPlugin process that loaded this DSO to be terminated.
*/
void BasicPluginBase::sendShutdownMessage(void)
{
LLPluginMessage shutdownmessage(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shutdown");
sendMessage(shutdownmessage);
}
#if LL_WINDOWS
# define LLSYMEXPORT __declspec(dllexport)
#elif LL_LINUX