diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2015-12-22 17:59:01 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2015-12-22 17:59:01 +0200 |
commit | b095e2c985680660d61a99e8dbac78d9113b9870 (patch) | |
tree | 171d31162fcb58f05c440de7ae383c7a88819a43 /indra/llplugin/llpluginprocessparent.h | |
parent | 49fa9b5515e708083c85aaa2b1b522bc266944c4 (diff) | |
parent | 60dfd55edaa5df0cb864dc5086037bc5625bc0be (diff) |
Merge
Diffstat (limited to 'indra/llplugin/llpluginprocessparent.h')
-rwxr-xr-x | indra/llplugin/llpluginprocessparent.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 24be7eb148..df1630255c 100755 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -30,6 +30,7 @@ #define LL_LLPLUGINPROCESSPARENT_H #include <queue> +#include <boost/enable_shared_from_this.hpp> #include "llapr.h" #include "llprocess.h" @@ -40,8 +41,9 @@ #include "lliosocket.h" #include "llthread.h" #include "llsd.h" +#include "llevents.h" -class LLPluginProcessParentOwner +class LLPluginProcessParentOwner : public boost::enable_shared_from_this < LLPluginProcessParentOwner > { public: virtual ~LLPluginProcessParentOwner(); @@ -55,8 +57,11 @@ public: class LLPluginProcessParent : public LLPluginMessagePipeOwner { LOG_CLASS(LLPluginProcessParent); + + LLPluginProcessParent(LLPluginProcessParentOwner *owner); public: - LLPluginProcessParent(LLPluginProcessParentOwner *owner); + typedef boost::shared_ptr<LLPluginProcessParent> ptr_t; + ~LLPluginProcessParent(); void init(const std::string &launcher_filename, @@ -89,7 +94,10 @@ public: void sendMessage(const LLPluginMessage &message); void receiveMessage(const LLPluginMessage &message); - + + static ptr_t create(LLPluginProcessParentOwner *owner); + void requestShutdown(); + // Inherited from LLPluginMessagePipeOwner /*virtual*/ void receiveMessageRaw(const std::string &message); /*virtual*/ void receiveMessageEarly(const LLPluginMessage &message); @@ -121,7 +129,10 @@ public: static bool canPollThreadRun() { return (sPollSet || sPollsetNeedsRebuild || sUseReadThread); }; static void setUseReadThread(bool use_read_thread); static bool getUseReadThread() { return sUseReadThread; }; + + static void shutdown(); private: + typedef std::map<void *, ptr_t> mapInstances_t; enum EState { @@ -133,6 +144,7 @@ private: STATE_HELLO, // first message from the plugin process has been received STATE_LOADING, // process has been asked to load the plugin STATE_RUNNING, // + STATE_GOODBYE, STATE_LAUNCH_FAILURE, // Failure before plugin loaded STATE_ERROR, // generic bailout state STATE_CLEANUP, // clean everything up @@ -143,6 +155,9 @@ private: EState mState; void setState(EState state); + bool wantsPolling() const; + void removeFromProcessing(); + bool pluginLockedUp(); bool pluginLockedUpOrQuit(); @@ -185,12 +200,15 @@ private: static apr_pollset_t *sPollSet; static bool sPollsetNeedsRebuild; static LLMutex *sInstancesMutex; - static std::list<LLPluginProcessParent*> sInstances; + static mapInstances_t sInstances; static void dirtyPollSet(); static void updatePollset(); void servicePoll(); static LLThread *sReadThread; - + + LLTempBoundListener mPolling; + bool pollTick(); + LLMutex mIncomingQueueMutex; std::queue<LLPluginMessage> mIncomingQueue; }; |