Added AIFetchInventoryFolder and more.

Added a new statemachine AIFetchInventoryFolder, which can be used
to fetch the contents of a folder by name or UUID.

Also added AIEvent (and one event,
AIEvent::LLInventoryModel_mIsAgentInvUsable_true, which is needed
for AIFetchInventoryFolder).

Fixed LLInventoryModel::sBackgroundFetchActive to correctly reflect
whether or not LLInventoryModel::backgroundFetch is added to
gIdleCallbacks.

Avoid duplicated entries in sFetchQueue.

Reset sFullFetchStarted in LLInventoryModel::stopBackgroundFetch to
allow for a renewed full fetch when some single-folder fetch stops it.

Added AIStateMachine::mQueued to make calling 'cont()' more robust:
calling cont() / idle() / cont() on a row would otherwise add a
statemachine twice to the active list, which would cause a crash
when it's killed.
This commit is contained in:
Aleric Inglewood
2011-05-22 22:01:11 +02:00
parent e1fb1fa6b7
commit 13560e292e
12 changed files with 603 additions and 11 deletions

View File

@@ -184,6 +184,7 @@ class AIStateMachine {
base_state_type mState; //!< State of the base class.
bool mIdle; //!< True if this state machine is not running.
bool mAborted; //!< True after calling abort() and before calling run().
bool mQueued; //!< True when the statemachine is queued to be added back to the active list.
S64 mSleep; //!< Non-zero while the state machine is sleeping.
// Callback facilities.
@@ -211,11 +212,11 @@ class AIStateMachine {
public:
//! Create a non-running state machine.
AIStateMachine(void) : mState(bs_initialize), mIdle(true), mAborted(true), mSleep(0), mParent(NULL), mCallback(NULL) { updateSettings(); }
AIStateMachine(void) : mState(bs_initialize), mIdle(true), mAborted(true), mQueued(false), mSleep(0), mParent(NULL), mCallback(NULL) { updateSettings(); }
protected:
//! The user should call 'kill()', not delete a AIStateMachine (derived) directly.
virtual ~AIStateMachine() { llassert(mState == bs_killed); }
virtual ~AIStateMachine() { llassert(mState == bs_killed && !mQueued); }
public:
//! Halt the state machine until cont() is called.