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:
@@ -113,6 +113,9 @@ protected:
|
||||
// Inherited from LLPluginProcessParentOwner.
|
||||
/*virtual*/ void receivePluginMessage(LLPluginMessage const&);
|
||||
|
||||
// Inherited from LLPluginProcessParentOwner.
|
||||
/*virtual*/ void receivedShutdown() { mPlugin->exitState(); }
|
||||
|
||||
//--------------------------------------
|
||||
// Debug use only
|
||||
//
|
||||
|
||||
@@ -553,6 +553,15 @@ void LLPluginProcessChild::receivePluginMessage(const std::string &message)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
|
||||
{
|
||||
std::string message_name = parsed.getName();
|
||||
if(message_name == "shutdown")
|
||||
{
|
||||
// The plugin is finished.
|
||||
setState(STATE_UNLOADING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(passMessage)
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
STATE_PLUGIN_LOADED, // plugin library has been loaded
|
||||
STATE_PLUGIN_INITIALIZING, // plugin is processing init message
|
||||
STATE_RUNNING, // steady state (processing messages)
|
||||
STATE_UNLOADING, // plugin has sent shutdown_response and needs to be unloaded
|
||||
STATE_UNLOADING, // plugin has sent shutdown and needs to be unloaded
|
||||
STATE_UNLOADED, // plugin has been unloaded
|
||||
STATE_ERROR, // generic bailout state
|
||||
STATE_DONE // state machine will sit in this state after either error or normal termination.
|
||||
|
||||
@@ -1001,6 +1001,11 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
|
||||
LL_DEBUGS("Plugin") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
|
||||
|
||||
}
|
||||
else if(message_name == "shutdown")
|
||||
{
|
||||
LL_INFOS("Plugin") << "received shutdown message" << LL_ENDL;
|
||||
mOwner->receivedShutdown();
|
||||
}
|
||||
else if(message_name == "shm_add_response")
|
||||
{
|
||||
// Nothing to do here.
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
virtual ~LLPluginProcessParentOwner();
|
||||
virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
|
||||
virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
|
||||
virtual void receivedShutdown() = 0;
|
||||
// This will only be called when the plugin has died unexpectedly
|
||||
virtual void pluginLaunchFailed() {};
|
||||
virtual void pluginDied() {};
|
||||
@@ -88,6 +89,9 @@ public:
|
||||
// Go to the proper error state
|
||||
void errorState(void);
|
||||
|
||||
// Go to exit state.
|
||||
void exitState(void) { setState(STATE_EXITING); }
|
||||
|
||||
void setSleepTime(F64 sleep_time, bool force_send = false);
|
||||
F64 getSleepTime(void) const { return mSleepTime; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user