summaryrefslogtreecommitdiff
path: root/indra/llplugin/llpluginprocessparent.h
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-12-18 14:10:02 -0800
committerRider Linden <rider@lindenlab.com>2015-12-18 14:10:02 -0800
commit909e4097433ab8e84a19e2119a9ecf05b3eebe64 (patch)
treefe11439e42d20f1f2eae81e772c68b0d9fdb2692 /indra/llplugin/llpluginprocessparent.h
parentb98469bd7db06973e6058118551e500dc094d3c0 (diff)
parent6dd80980cfa5be214c143d125cfabd006ea7ebff (diff)
Merge
Diffstat (limited to 'indra/llplugin/llpluginprocessparent.h')
-rwxr-xr-xindra/llplugin/llpluginprocessparent.h28
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;
};